1
Functions in python
mhs_mhs123 (4)

Hey everyone, I'm a new python dev and i'm trying to familiarize myself with functions. for my first functions project, I tried making a miles to km converter, but I'm running into an error. can someone tell me what I did wrong and how to fix it. Thanks.

https://repl.it/@mhs_mhs123/milestokmconverter

You are viewing a single comment. View All
1
HenryShearer (2)

I agree (mark @eankeen as the right answer). You've defined what you want the function to do, but you haven't actually told the computer to carry out that function. It's like getting a recipe but not using it.

This works for me:
def convert(miles):
print('in km:')
km = miles*1.609
print(km)

convert(20)