Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: phlipper/lpthw
base: bca0ebd25d
...
head fork: phlipper/lpthw
compare: a12c4c98e4
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 35 additions and 0 deletions.
  1. +35 −0 ex5.py
35 ex5.py
View
@@ -0,0 +1,35 @@
+name = 'Zed A. Shaw'
+age = 35 # not a lie
+height = 74 # inches
+weight = 180 # lbs
+eyes = 'Blue'
+teeth = 'White'
+hair = 'Brown'
+
+print "Let's talk about %s." % name
+print "He's %d inches tall." % height
+print "He's %d pounds heavy." % weight
+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, weight, age + height + weight)
+
+# extra credit
+
+# Change all the variables so there isn't the my_ in front. Make sure you
+# change the name everywhere, not just where you used = to set them.
+
+# Try more format characters. %r is a very useful one. It's like saying
+# "print this no matter what".
+print "print %r no matter what" % (1 + 2 + 3)
+
+# Search online for all of the Python format characters.
+
+# Try to write some variables that convert the inches and pounds to
+# centimeters and kilos. Do not just type in the measurements. Work out the
+# math in Python.
+print "%d inches is the same as %.02f centimeters" % (5.0, (5.0 * 2.54))
+print "%d pounds is the same as %.04f kilos" % (180.0, (180.0 * 0.4536))

No commit comments for this range

Something went wrong with that request. Please try again.