print "I will now count my chickens:" # testing math print "Hens", 25.0 + 30.0 / 6.0 print "Roosters", 100.0 - 25.0 * 3.0 % 4.0 print "Now I will count the eggs:" print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 print "Is it true that 3 + 2 < 5 - 7?" print 3 + 2 < 5 - 7 print "What is 3 + 2?", 3 + 2 print "What is 5 - 7?", 5 - 7 print "Oh, that's why it's False." print "How about some more." #Now we're testing geater than, less than, and equal cases print "Is it greater?", 5 > -2 print "Is it greater or equal?", 5 >= -2 print "Is it less or equal?", 5 <= -2 # looking for a floating point test example, also testing the use of spaces for math print "I want a floating point number!!" print 3.2 / 4.7777 print 5.0/2.0 #Parentheses, exponents, multiplication, Division, Addition, Subtraction. #note, I need to use print to show my math output 5+5
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