Skip to content

Commit

Permalink
Menu#2
Browse files Browse the repository at this point in the history
  • Loading branch information
omarbelkady authored Apr 4, 2021
1 parent cbb0ab5 commit d0441f1
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Conditionals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,51 @@ def my_menu():
print("Done")
my_menu()
```

### Menu Type 3:
```python
def my_menu():
print("Welcome to the Conversion Calculator which option would you like\
\n a. Miles to Kilometers\
\n b. Gallons To Liters\
\n c. Pounds to Kilograms\
\n d. Inches To Cm\
\n e. Fahrenheight To Celsius")
option= str(input("Which type of conversion are you wishing to perform: "))
if option == 'a' or option == 'A':
print("\n\nYou are converting Miles to Km")
n = float(input("What is amount of miles you wish to convert to km?: "))
print(milesToKm(n))
elif option == 'b' or option == 'B':
print("\n\nYou are converting Gallons to Liters")
g = float(input("\nWhat is amount of gallons you wish to convert to liters?: "))
print(gallonsToLiters(g))
elif option == 'c' or option == 'C':
print("\n\nYou are converting Pounds to Kg")
l = float(input("\nWhat is amount of lb you wish to convert to kg?: "))
print(lbsToKg(l))
elif option == 'D' or option == 'D':
print("\n\nYou are converting Inches to Cm")
c = float(input("\nWhat is amount of Inches you wish to convert to Cm?: "))
print(inchesToCm(c))
elif option == 'e' or option == 'E':
print("\n\nYou are converting Fahrenheight To Celsius")
cels = int(input("\nWhat is the temperature in Fahrenheight you wish to convert to Celsius?: "))
print(fahrenToCels(cels))
elif ValueError:
print("That was a wrong choice")
my_menu()
else:
print("Done")

def milesToKm(miles: int) -> float:
return miles*1.60934
def gallonsToLiters(gallons: float) -> float:
return gallons*3.78541
def lbsToKg(pounds: float) -> float:
return pounds*0.453592
def inchesToCm(inches: float) -> float:
return inches*2.54
def fahrenToCels(fahren: float) -> float:
return((fahren-32)/1.8)
```

0 comments on commit d0441f1

Please sign in to comment.