#!/usr/bin/env python number = int(raw_input("Enter an integer: ")) if number < 100: print "Your number is smaller than 100" else: print "Your number is greater than 100"
[kd@kdlappy book]$ ./testhundred.py Enter an integer: 13 Your number is smaller than 100 [kd@kdlappy book]$ ./testhundred.py Enter an integer: 123 Your number is greater than 100
#!/usr/bin/env python amount = float(raw_input("Enter amount: ")) inrate = float(raw_input("Enter Interest rate: ")) period = int(raw_input("Enter period: ")) value = 0 year = 1 while year <= period: value = amount + (inrate * amount) print "Year %d Rs. %.2f" %(year, value) amount = value year = year + 1
[kd@kdlappy book]$ ./investment.py Enter amount: 10000 Enter Interest rate: 0.14 Enter period: 5 Year 1 Rs. 11400.00 Year 2 Rs. 12996.00 Year 3 Rs. 14815.44 Year 4 Rs. 16889.60 Year 5 Rs. 19254.15