cars = 100 space_in_a_car = 4.5 drivers = 30 passengers = 90 cars_not_driven = cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in_a_car average_passengers_per_car = passengers / cars_driven print print "There are", cars, "cars available" print "there are only", drivers, "drivers available." print "there will be", cars_not_driven, "empty cars." print "we can transport", carpool_capacity, "people today." print "we have", passengers, "to carpool today." print "we need to put about", average_passengers_per_car, "in each car." print my_name = 'Chris Eckert' my_age = 26 my_hight = 5* 12 + 9 my_weight = 140 my_teeth = 'white' my_eyes = 'blue' my_hair = 'brown' print print "let's talk about %s." % my_name print "He's %d inches tall." % my_hight print "He's %d pounds heavy." % my_weight print "Actually that's really not heavy at all!" print "He's got %s eyes and %s hair." % (my_eyes, my_hair) print "His teeth are usually %s depending on the coffee." % my_teeth # print "if I add %d, %d, and %d I get %d." % (my_age, my_hight, my_weight, my_age + my_weight + my_hight) print x = "There are %d types of people." % 10 binary = "binary" do_not = "don't" y = "Those who know %s and those who %s." % (binary, do_not) print x print y print "I said: %r." %x print "I also said: '%s'." %y hilarious = False joke_evaluation = "Isn't that joke so funny?! %r" print joke_evaluation % hilarious w = "this is the left side of..." e = "a string with a right side." print w + e print print
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