Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
my_name = 'Zed A. Shaw' | ||
my_age = 35 # not a lie | ||
my_height = 74 # inches | ||
my_weight = 180 # lbs | ||
my_eyes = 'Blue' | ||
my_teeth = 'White' | ||
my_hair = 'Brown' | ||
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." % my_name | ||
print "He's %d inches tall." % my_height | ||
print "He's %d pounds heavy." % my_weight | ||
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." % (my_eyes, my_hair) | ||
print "His teeth are usually %s depending on the coffee." % my_teeth | ||
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." % ( | ||
my_age, my_height, my_weight, my_age + my_height + my_weight) | ||
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)) |