Create a program that allows the user to enter the type of coin to be evaluated
ID: 3552688 • Letter: C
Question
Create a program that allows the user to enter the type of coin to be evaluated and the number of coins. The program should calculate the total weight of the coins and the height of the coins when stacked. Name the program coins.py. Use the table below for weights and height.
g = grams
mm = millimeters
I have this assignment for class and was wondering if anyone would help me with this?
COIN WEIGHT HEIGHT $0.01 2.500g 1.52mm $0.05 5.000g 1.95mm $0.10 2.268g 1.35mm $0.25 5.670g 1.75mm $0.50 11.34g 2.15mm $1.00 8.10g 2.00mmExplanation / Answer
# program greeting print("The purpose of this exercise is to enter a number of coin values") print("that add up to a displayed target value. ") print("Enter coins values as 1-penny, 5-nickel, 10-dime,and 25-quarter.") print("Hit return after the last entered coin value.") print("--------------------") #print("Enter coins that add up to 81 cents, one per line.") import sgenrand #prompt the user to start entering coin values that add up to 81 while True: total = 0 final_coin= sgenrand.randint(1,99) print ("Enter coins that add up to", final_coin, "cents, on per line") user_input = int(input("Enter first coin: ")) if user_input != 1 and user_input!=5 and user_input!=10 and user_input!=25: print("invalid input") else: total = total + user_input while total final_coin : print("Sorry - total amount exceeds", (final_coin)) elif totalRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.