print "I will now count my chickens:" # Order of operations says that 30 will be divided by 6 first then added to 25. print "Hens", 25 + 30 / 6 # 25 times 3 first then you find the modulus of 75 and 4 and substract that from 100. print "Roosters", 100 - 25 * 3 % 4 print "Now I will count my eggs:" # find the modulus of 4 and 2, divide 4 into 1, then add 3,2 and 1 together, subtract 5, add the modulus # from earlier, subtract 1/4 and finally add 6. print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 print "Is it true that 3 + 2 < 5 - 7?" # A boolean check comparing 5 to -2 and seeing whether 5 is less than -2. print 3 + 2 < 5 - 7 # Adding 3 and 2 together. print "What is 3 + 2?", 3 + 2 # Subtracting 7 from 5. print "What is 5 - 7?", 5 - 7 print "Oh, that's what its false." print "How about some more." # A boolean check to see if 5 is greater than -2. print "Is it greater?", 5 > -2 # Aother boolean check of 5 and -2, checking to see if 5 is greater than or equal to -2. print "Is it greater or equal to?", 5 >= -2 # A final boolean check testing if 5 is less than or equal to -2 print "Is it less or equal to?", 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