diff --git a/youngjin.han/python-the-hard-way/ex3.py b/youngjin.han/python-the-hard-way/ex3.py index 1276637..5f44bfe 100644 --- a/youngjin.han/python-the-hard-way/ex3.py +++ b/youngjin.han/python-the-hard-way/ex3.py @@ -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 diff --git a/youngjin.han/python-the-hard-way/ex5.py b/youngjin.han/python-the-hard-way/ex5.py new file mode 100644 index 0000000..d38c795 --- /dev/null +++ b/youngjin.han/python-the-hard-way/ex5.py @@ -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}.") diff --git a/youngjin.han/python.org b/youngjin.han/python.org index 626f3d1..8e5b4ce 100644 --- a/youngjin.han/python.org +++ b/youngjin.han/python.org @@ -8,4 +8,8 @@ - none - ex4.py - car_pool_capacity is not defined. + - ex5.py + - none + - ex6.py + - + is to add two string array.