name = 'Zed A. Shaw' age = 35 # not a lie height = 74 # inches height_cm = height * 2.54 weight = 180 # lbs weight_kg = weight * 0.45 eyes = 'Blue' teeth = 'White' hair = 'Brown' print "Let's talk about %s." % name print "He's %d centimeters tall." % height_cm print "He's %d kilograms heavy." % weight_kg print "Actually that's not too heavy." print "He's got %s eyes and %s hair." % (eyes, hair) print "His teeth are usually %s depending on the coffee." % teeth # this line is tricky, try to get it exactly right print "If I add %d, %d, and %d I get %d." % (age, height_cm, weight_kg, age + height_cm + weight_kg) # hex and octal printing hx_num = 0xDA5 print hx_num print "hexa value %x" % hx_num oct_num = 0o011 print oct_num print "octal value %o" % oct_num
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