r/programminghelp • u/JacksonG • Oct 07 '21
Python Need assistance writing code that converts cm into mm, inches, or feet
Hello,
This is my first post here, so apologies if this post isn't rule friendly.
My assignment for Computer Science is to write a program that converts cm into mm, inches, or feet based on the users choice. We're required to use if statements.
I'm very new to this, so I apologize if my coding is amateurish.
Here is what I have so far:
cm=float(input("How many cm do you want to convert?"))
choice=input("Choose (m)m, (i)nches, (f)eet:")
if choice=='m' :
print(cm*10)When I run the program, it accepts the inputs, but doesn't print cm*10. What am I doing wrong?
4
Upvotes
1
u/[deleted] Oct 07 '21
As long as the user is choosing mm by pressing "m", the code seems to work fine. You haven't given code for the other options (inches and feet). What steps are you taking that it doesn't print anything?