RESOURCES:
Class slides: https://docs.google.com/presentation/d/1iPT_gnG2iSXXjWj2tE6gbsdg4V0Sy8rY08SC5SoB9CA/edit?usp=sharing
Example code: https://replit.com/@ShravyaS/IntrotoPython-3
(No bullet notes this week.)
HOMEWORK:
Write code to take in two integers: the first represents feet and the second is inches of someone’s height (like 5 feet 4 inches). Print out what the height is in feet with decimal points, then print out what the height is in meters.
Write your answer as a comment, and we’ll post the solution by next class. See you then!
Note: VIP students, please contact us (Eric and I) about office hours!
Solutions:
feet = int(input("How many feet tall are you?")) inches = int(input("How many inches tall are you?")) feet2 = feet + (inches/12) print("You are", feet2, "feet tall!")
print("You are", (feet2*0.3048), "meters tall!")
print("A Silver Arowana fish is 3 feet and 3 inches, in feet, it's") v = int(3 / 1) print(v, "and") x = float(3 / 12) print(x, "feet")
print('Please input the feet of height'); f_height = int(input()); print('Please input the inch of height'); i_height = int(input()); print('The height is', f_height,'feet and',i_height,'inch'); total_feet = f_height + i_height/12; print("The height in feet is", total_feet, "feet"); total_meter = total_feet * 0.3048; print("The height in meter is", total_meter, "meter");
print('feet') f = float(input()) print('inches') i = float(input()) if i == 12: print(f+1) elif i > 9: print(f+(i/100)) elif i < 10: print(f+(i/10)) print((f+i)/3.281, 'meters')