Convert miles to kilometers.
I am telling you just one thing:
1 mile = 1.609344 kilometers
Now, think what you can do with this information.
miles = float(input("Enter distance in miles: "))
kilometers = miles*1.609344
print("Distance in Kilometers:", kilometers)Just take a number from the user. Allow the user to enter a float number. Then, multiply that number by 1.609344. Keep the multiplication in the kilometers variable.
The kilometers is your answer.
Oh, wait...you are not done yet!
Now, tell me, if you have to do this using a function, how will you do that?
Go to the code editor and then try it yourself. When you do it yourself without following instructions, you will understand it. You will be able to feel the code and that is a big step in becoming a programmer!
tags: programming-hero python python3 problem-solving programming coding-challenge interview learn-python python-tutorial programming-exercises programming-challenges programming-fundamentals programming-contest python-coding-challenges python-problem-solving
