-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKPH_MPH.py
More file actions
37 lines (34 loc) · 1.14 KB
/
Copy pathKPH_MPH.py
File metadata and controls
37 lines (34 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Scratch
def to_MPH(KPH):
return KPH*0.621371
def to_KPH(MPH):
return MPH*1.60934
while True:
cont = "Y"
convert = input("\nWhat to Convert [KPH to MPH: M or MPH to KPH: K] [Enter 'E' to Exit]\n")
if convert == "E":
break
try:
if (convert.upper() == "M"):
while(cont.upper()=="Y"):
KPH = int(input("\nEnter KPH : "))
print("Thats's {} MPH".format(to_MPH(KPH)))
print()
cont = input("Do you want to do another conversion?\n[Y to Continue N to Main menu]\n")
if cont == "N":
break
elif (convert.upper() == "K"):
while(cont.upper()=="Y"):
MPH = int(input("\nEnter MPH : "))
print("That's {} KPH".format(to_KPH(MPH)))
print()
cont = input("Do you want to do another conversion?\n[Y to continue N to Main menu]\n")
if cont =="N":
break
else:
print("Err_input")
continue
except:
print("Invalid input. Please try again.")
continue
print("Good bye!")