If - Else - Worksheet (Class 11)
If - Else - Worksheet (Class 11)
if((ch >= 'a' and ch <= 'z') or (ch >= 'A' and ch <= 'Z')):
print("The Given Character ", ch, "is an Alphabet")
elif(ch >= '0' and ch <= '9'):
print("The Given Character ", ch, "is a Digit")
else:
print("The Given Character ", ch, "is Not an Alphabet or a Digit")
OR
8. Write a program to input the cost price and the selling price of an article. If
the selling price is more than the cost price then calculate and display actual
profit and profit per cent otherwise, calculate and display actual loss and loss
per cent. If the cost price and the selling price are equal, the program displays
the message 'Neither profit nor loss'.
9. Without using if-else statement and ternary operators, accept three unequal
numbers and display the second smallest number.
10. A Pre-Paid taxi charges from the passenger as per the tariff given below:
Distance Rate
Up to 5 km ₹ 100
For the next 10 km ₹ 10/km
For the next 10 km ₹ 8/km
More than 25 km ₹ 5/km
Write a program to input the distance covered and calculate the amount paid by
the passenger. The program displays the printed bill with the details given
below:
Taxi No. :
Distance covered :
Amount :
11. A cloth showroom has announced festival discounts and the gifts on the
purchase of items, based on the total cost as given below:
Total Cost Discount Gift
Up to ₹ 2,000 5% Calculator
₹ 2,001 to ₹ 5,000 10% School Bag
₹ 5,001 to ₹ 10,000 15% Wall Clock
Above ₹ 10,000 20% Wrist Watch
Write a program to input the total cost. Compute and display the amount to be
paid by the customer along with the gift.