#prints a statement of intent: print "I will now count my chickens:" #prints a word, a space, then the result of a math problem (30): print "Hens", 25.000 + 30.000 / 6.000 #as above, prints a word, a space, then the result of a different math problem #the % here is "modulo", returning the remainder of dividing the first number by the second #In the order of operations, % happens at the same level as * and / print "Roosters", 100.0 - 25.0 * 3.0 % 4.0 #Prints another statement of intent to enumerate: print "Now I will count the eggs:" #Prints the result of another complicated math problem: #Here the addition and subtraction come before the %? #Figure this out! print 3.00 + 2.00 + 1.00 - 5.00 + 4.00 % 2.00 - 1.00 / 4.00 + 6.00 #Prints a question: print "Is it true that 3 + 2 < 5 - 7?" #Prints the logical result of the inequality: print 3 + 2 < 5 - 7 #prints a breakdown of the inequality's components: print "What is 3 + 2?", 3 + 2 print "What is 5 - 7?", 5 - 7 #Prints print "Oh, that's why it's False." #Prints print "How about some more." #Prints a series of questions that are answered by logical tests print "Is it greater?", 5 > -2 print "Is it greater or equal?", 5 >= -2 print "Is it less or equal?", 5 <= -2
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