print "Chapter 7" print "" sprice = float(raw_input("What is your price? ")) if sprice == 10 or sprice < 10: eprice = sprice - (sprice/10.0) else: eprice = sprice - ((sprice/10.0)*2) print "$" + str(eprice) print "" g = raw_input("Are you a girl, or a boy? ") if g == "girl": a = int(raw_input("How old are you? ")) if a < 13 and a > 9: print "You can join the team" else: print "You can't join, because you are not 10 to 12 years old. Sorry." else: print "You have to be a girl to join. Sorry." print "" SOT = float(raw_input("What is the size of your tank? ")) PF = float(raw_input("Percent full? ")) KPL = float(raw_input("Km per liter? ")) km = ((SOT / 100)* PF) * KPL print "" print "You can go another " + str(km) + " km" print "The next gas station is 200 km away" if km < 200: print "Get gas now!" else: print "You can wait for the next station" print "" password = "password" epassword = raw_input("What is the password? ") if epassword == "password": print "You typed in the right password!" else: print "You got the wrong password" print "" print "Chapter 8" print "" mt = raw_input("Which multiplication table would you like? ") mt = int(mt) h = raw_input("How high do you want to go? ") h = int(h) + 1 print "Here's your table:" for i in range(1,h): print str(mt) + " * " + str(i) + " = " + str(mt * i) print "" print "Here's table #2:" i = 1 while i < 11: print str(mt) + " * " + str(i) + " = " + str(mt * i) i = i + 1
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question