Learning Circle : pytion #1 - ex5
This commit is contained in:
parent
526f0688a1
commit
2531ef78c5
3 changed files with 30 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
print("I will now count my chickens:")
|
||||
|
||||
print("Hens", 25 + 30 / 6) # 25 + (30 / 6) = 25 + 5 = 30
|
||||
|
||||
print("Roosters", 100 - 25 * 3 % 4) # 100 - (25 * 3 % 4) = 100 - (75 % 4) = 100 - 3 = 97
|
||||
|
|
24
youngjin.han/python-the-hard-way/ex5.py
Normal file
24
youngjin.han/python-the-hard-way/ex5.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
name = 'Zed A. Shaw'
|
||||
age = 35 # not a lie
|
||||
height = 74 # inches
|
||||
weight = 180 # lbs
|
||||
eyes = 'Blue'
|
||||
teeth = 'White'
|
||||
hair = 'Brown'
|
||||
|
||||
inch_to_cm = 2.54
|
||||
lbs_to_kg = 0.45359237
|
||||
|
||||
cm_height = height * inch_to_cm
|
||||
kg_weight = weight * lbs_to_kg
|
||||
|
||||
print(f"Let's talk about {name}.")
|
||||
print(f"He's {height} inches or {cm_height} cm tall. ")
|
||||
print(f"He's {weight} pounds or {kg_weight} kg heavy.")
|
||||
print("Actually that's not too heavy.")
|
||||
print(f"He's got {eyes} eyes and {hair} hair.")
|
||||
print(f"His teeth are usually {teeth} depending on the coffee.")
|
||||
|
||||
# this line is tricky, try to get it exactly right
|
||||
total = age + height + weight
|
||||
print(f"If I add {age}, {height}, and {weight} I get {total}.")
|
|
@ -8,4 +8,8 @@
|
|||
- none
|
||||
- ex4.py
|
||||
- car_pool_capacity is not defined.
|
||||
- ex5.py
|
||||
- none
|
||||
- ex6.py
|
||||
- + is to add two string array.
|
||||
|
||||
|
|
Loading…
Reference in a new issue