# 1.
Bike Road Tax and Final Amount
price = float(input("Enter cost price of bike: "))
if price > 100000:
tax = 0.15 * price
elif price > 50000:
tax = 0.10 * price
else:
tax = 0.05 * price
print("Road Tax:", tax)
print("Final Amount:", price + tax)
# 2. Square and Cube using Lambda
nums = [1, 2, 3, 4]
print("Squares:", list(map(lambda x: x**2, nums)))
print("Cubes:", list(map(lambda x: x**3, nums)))
# 3. Menu-driven Calculator with Exception Handling
def calculator():
while True:
print("\n1.Add 2.Subtract 3.Multiply 4.Divide 5.Exit")
try:
ch = int(input("Choice: "))
if ch == 5: break
a = float(input("A: "))
b = float(input("B: "))
if ch == 1: print("Sum:", a + b)
elif ch == 2: print("Diff:", a - b)
elif ch == 3: print("Product:", a * b)
elif ch == 4: print("Quotient:", a / b)
else: print("Invalid Choice")
except Exception as e:
print("Error:", e)
calculator()
# ... (content continues until #38)