## Missy_poo

I need help with writing a program that asks the user to enter distance in kilometers and then converts distance to miles

## JasonHippy 724

What have you got so far?

## jlm699 320

As far as asking the user for input use either raw_input or input depending on your version of Python. Then the conversion is simple math. Just google "1 kilometer to miles" and it will give you the conversion rate.

## Missy_poo

i'm just starting out with this problem so i really don't know where to start

## snippsat 661

Not much help to give you without solving it.
Look a little on this.

``````>>> km = raw_input('How many km? ')
How many km? 100
>>> km
'100'
>>> #As you see km is now a string
>>> type(km)
<type 'str'>
>>> #make intreger
>>> int(km)
100
>>> #100 * ??? what mystery number give miles?``````

For python 2.x use always raw_input(and convert to what you need)
Python 3.x has only input same as raw_input(it return a string too)

## vegaseat 1,720

As little as I can remember 1 mile is about 1.6 km, so 1 km is 1/1.6 miles.

## jlm699 320

As little as I can remember 1 mile is about 1.6 km, so 1 km is 1/1.6 miles.

1 kilometer = 0.621371192 miles

## zachabesh 5

Whenever I start a script I usually write out in plain English what I want to do. It will keep you organized and you will never not know "where to start." Comment out the plain english, and script around it.

For example, here is the "skeleton" for a script to get the statistics of every major league baseball player:

``````#query MLB database
#parse results
#display results``````

Now, this script would obviously be tediously complicated and long, boring, etc... But, I know know where to start. I first need to query the MLB database. I may want to do a sub-skeleton here, because qerying a database has several different steps, so I might have to do some googling on querying a database using python. But, I know what I'm doing, and I've split my code into 3 parts. Yay me.

So let's see a skeleton for your script, and then we'll give you some tips. :)

Here are some more example skeletons:

Process a restaurant bill

``````#get all the items ordered
#get the total price
#add gratuity if there are more than 6 people
#print the bill``````

rename all files in a directory

``````#get a list of all the files in the directory
#loop through the files, renaming them``````