Python Forum

Full Version: General coding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
HI to all
I needto kwnow what this code below don't work in python.
def Add5(in)
out=in+5
return out
print(Add5(10))

HI to all
I needto kwnow what this code below don't work in python.
def Add5(in)
out=in+5
return out
print(Add5(10))
You haven't said what "doesn't work" means, but at a guess: in is a keyword, so can't be used as a variable name.
your code lack indentation, unless it's a problem of how you post your code
there is missing colon at the end of def Add5(in)
as @ndc85430 said - in cannot be used as name

finally, always post full traceback you get in error tags.