6-5 56325423-87324 473*322 23/2 23.0/2.0 23%2 #i am a comment 648+(5*7)/6 #lesson 3 print "hi there guys" print "i was wondering how this shit works", print "still not altogether sure" #break print "this program is a demo" v=1 print "the value of v is now", v v=v+1 print "v now equals itself plus one, making it worth", v #variables demonstrated print "This program is a demo of variables" v = 1 print "The value of v is now", v v = v + 1 print "v now equals itself plus one, making it worth", v v = 51 print "v can store any numerical value, to be used elsewhere." print "for example, in a sentence. v is now worth", v print "v times 5 equals", v*5 print "but v still only remains", v print "to make v five times bigger, you would have to type v = v * 5" v = v * 5 print "there you go, now v equals", v, "and not", v / 5 #giving variables text, and adding text. word1 = "Good" word2 = "Morning" word3 = "to you too!" print word1, word2 sentence = word1 + " " + word2 + " " +word3 print sentence #EXAMPLE #Type this in, see what it does x = 10 while x != 0: print x x = x - 1 print "wow, we've counted x down, and now it equals", x print "And now the loop has ended." x=5 while x <= 100000000: print x x=x*5 print "and were done"
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