Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
General coding
#1
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))
Reply
#2
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.
Reply
#3
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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  General Coding Help biswajitmaity 2 1,759 Aug-25-2021, 03:04 PM
Last Post: jefsummers
  General coding help prathmesh 1 1,878 Apr-01-2020, 01:23 PM
Last Post: buran
  general coding error karai 1 2,531 Mar-21-2018, 06:36 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020