In this simple program it will ask the user to give the distance in kilometers and then our program will convert the given distance in miles into kilometers equivalent using Python as my programming language.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
def my_program():
print()
print("KILOMETERS TO MILES CONVERTER")
print()
kilometers = float(input("How many kilometer(s) ? : "))
print()
miles = (kilometers * 0.621371)
print('%0.2f Kilometers(s) is equal to %0.2f Mile(s).' %(kilometers,miles))
print("\n");
repeat = input('Do you want to continue ? (Y/N) : ')
if repeat.upper() == "N":
print("\n")
print("END OF PROGRAM")
quit
if repeat.upper() == "Y":
my_program()
if __name__ == '__main__':
my_program()
No comments:
Post a Comment