Using Variables and Assigned Statements (Converting MPH)

I’m trying to understand what I’m missing on this challenge. I’m sure there are many things missing but I’m kinda stuck here. I constantly keep getting the output:

File “”, line 1
SyntaxError: invalid syntax

Can somebody please tell me how I can fix that issue.

Other than that, I was able to answer some of the problems with this code:image

The output for this is:


I tried adding labels (such as km/hr) but when I did, it told me I had errors with the str and int. I did not understand how. Anyhow, am I close to correct? Any help or explanation you could give would help.

Thank you,

Hey James!

Thanks for reaching out! Hmm, are you running the python3 command inside a Python shell? This could be the reason for the SyntaxError.

Yes, your code is very close! :slight_smile: The output is expecting floats (i.e. 75.0, 46.875, and 20.833). By changing the ints in your code to floats, the first and third tasks will pass.

The second task is not passing because the formula should be Miles_per_hour = Distance_miles / Time_hr, not mph / Km_hr. Once you change this (and the ints), you should be able to complete the challenge!

If this does not solve your issue, could you please send us your Share URL so we can see what’s going on? This can be found in the left sidebar under the “Share” icon.


THANK YOU!!! I have been getting so frustrated and doubting myself working on these into the night but you make me feel like I’m making progress (albeit slowly). Thank you so much for finding my errors and making this something I feel that I can do.


1 Like

No problem at all, James! This is definitely something you can do! :muscle: let me know if you have any other questions - I’d be happy to help! :slight_smile: