Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=====================================#
- #==============MODULES================#
- #=====================================#
- #=====================================#
- #==============VARIABLES==============#
- #=====================================#
- var = 2.2046
- menus = ["(1) Lbs to Kgs", "(2) Kgs to Lbs", "(3) Exit "
- #=====================================#
- #==============FUNCTIONS==============#
- #=====================================#
- #defines menu
- def menu(parameter):
- print " +==============+"
- print " | CONVERSIONS |"
- print " | MENU |"
- print " |==============|"
- for word in parameter:
- print " |%s|" % word
- print " |--------------|"
- #defines algorithm for Lb to Kg
- def lb2kg(var, weight):
- kilograms = (weight / var)
- print "%s lbs is %s kgs" % (weight, kilograms)
- #defines algorithm for Kg to Lb
- def kg2lb(var, weight):
- lbs = (weight * var)
- print "%s kgs is %s lbs" % (weight, lbs)
- #=====================================#
- #=============MAIN PROGRAM============#
- #=====================================#
- def main():
- menu(menus)
- choice = input("Please make a selection(1-3): ")
- if choice == 1:
- lb2kg(var, weight)
- elif choice == 2:
- ks2lb(var, weight)
- elif choice == 3:
- print "Exiting Program. Goodbye"
- return
- else:
- print "Invalid Selection"
- return main()
Add Comment
Please, Sign In to add comment