filmov
tv
Building a Measurement Converter in Python

Показать описание
Angled Brackets aren't allowed in a description so I replaced it with a ~
main_menu = int(input("\nConvert Centimetres/Millimetres [1]\nConvert Inches [2]\nConvert Feet [3]\n--~ "))
if main_menu == 1:
cm_menu = int(input("\nInto Inches [1]\nInto Feet [2]\n--~ "))
if cm_menu == 1:
cm_inch = float(input("\nInput cm/mm\n--~ "))
print(f"\n{cm_inch}cm/mm --~ {cm_inch / 2.54} Inches")
elif cm_menu == 2:
cm_feet = float(input("\nInput cm/mm\n--~ "))
print(f"\n{cm_feet}cm/mm --~ {cm_feet / 30.48} Feet")
else:
print("\nInvalid Input")
elif main_menu == 2:
inch_menu = int(input("\nInto Centimetres [1]\nInto Feet [2]\n--~ "))
if inch_menu == 1:
inch_cm = float(input("\nInput Inches\n--~ "))
print(f"\n{inch_cm} Inches --~ {inch_cm * 2.54}cm/mm")
elif inch_menu == 2:
inch_feet = float(input("\nInput Cm/m\n--~ "))
print(f"\n{inch_feet} Inches --~ {inch_feet / 12} Feet")
elif main_menu == 3:
foot_menu = int(input("\nInto Centimetres [1]\nInto Inches [2]\n--~ "))
if foot_menu == 1:
foot_cm = float(input("\nInput Feet\n--~ "))
print(f"\n{foot_cm} Feet --~ {foot_cm * 30.48}cm/mm")
elif foot_menu == 2:
foot_inch = float(input("\nInput Feet\n--~ "))
print(f"\n{foot_inch} Feet --~ {foot_inch * 12} Inches")
main_menu = int(input("\nConvert Centimetres/Millimetres [1]\nConvert Inches [2]\nConvert Feet [3]\n--~ "))
if main_menu == 1:
cm_menu = int(input("\nInto Inches [1]\nInto Feet [2]\n--~ "))
if cm_menu == 1:
cm_inch = float(input("\nInput cm/mm\n--~ "))
print(f"\n{cm_inch}cm/mm --~ {cm_inch / 2.54} Inches")
elif cm_menu == 2:
cm_feet = float(input("\nInput cm/mm\n--~ "))
print(f"\n{cm_feet}cm/mm --~ {cm_feet / 30.48} Feet")
else:
print("\nInvalid Input")
elif main_menu == 2:
inch_menu = int(input("\nInto Centimetres [1]\nInto Feet [2]\n--~ "))
if inch_menu == 1:
inch_cm = float(input("\nInput Inches\n--~ "))
print(f"\n{inch_cm} Inches --~ {inch_cm * 2.54}cm/mm")
elif inch_menu == 2:
inch_feet = float(input("\nInput Cm/m\n--~ "))
print(f"\n{inch_feet} Inches --~ {inch_feet / 12} Feet")
elif main_menu == 3:
foot_menu = int(input("\nInto Centimetres [1]\nInto Inches [2]\n--~ "))
if foot_menu == 1:
foot_cm = float(input("\nInput Feet\n--~ "))
print(f"\n{foot_cm} Feet --~ {foot_cm * 30.48}cm/mm")
elif foot_menu == 2:
foot_inch = float(input("\nInput Feet\n--~ "))
print(f"\n{foot_inch} Feet --~ {foot_inch * 12} Inches")