Below is a series of different programs that have pseudocode and flowcharts completed for them. Use them to try and relate your algorithm designs to your code.
This program is designed to show how you might convert miles to kilometres and vice-versa.
#Measurement Conversion Function (sub-programs) def mtokm(value): answer = value*1.6 return answer def kmtom(value): answer = value*0.62 return answer print("What conversion would you like to do?") print("1. Convert Miles to Kilometres") print("2. Convert Kilometres to Miles") option = input(">>") print() number = float(input("Enter your measurement to convert: ")) if option=="1": print(str(number) + " miles in KM is " + str(mtokm(number))) elif option=="2": print(str(number) + " KM in miles is " + str(kmtom(number))) else: print("Please enter a valid selection")