# numberx and stringx are variables # they are like boxes that have a name written on them # we can put anything in them # then use them numberx = 5 stringx = "this is a string" print(numberx) print(stringx) # 5 is a string here, not a number stringx = stringx + " 5 " print(stringx) # we can :) do arithmetic with variables that contain numbers print(numberx * 10) print(numberx / 2) # we can't :( do arithmetic with variables that contain numbers #print(stringx / 2) #print(stringx + 4) # sometimes arithmetic works with strings what do you think this will do ? print(stringx * 4)
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