Skip to content

Latest commit

 

History

History
42 lines (25 loc) · 1.46 KB

File metadata and controls

42 lines (25 loc) · 1.46 KB

Miles to Kilometers

The Problem

Convert miles to kilometers.

Hints

I am telling you just one thing:

1 mile = 1.609344 kilometers

Now, think what you can do with this information.

The solution

miles = float(input("Enter distance in miles: "))
kilometers = miles*1.609344
print("Distance in Kilometers:", kilometers)

Try it on Programming Hero

Explanation

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!

Try it on Programming Hero

  Next Page  

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