Click here to Skip to main content
14,870,621 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
def Avg (a,b)
Return a+b /2
print (Avg (1,2) )

What I have tried:


what is the value in python
Updated 14-Apr-21 20:16pm

Run it and see: Online Python Compiler - online editor[^]
But I'll give you a clue: "SyntaxError: invalid syntax"
This fix your syntax errors
def Avg (a,b):
  return a+b/2

print (Avg (1,2))

and this fix also your semantic error
def Avg (a,b):
  return (a+b)/2

print (Avg (1,2))

eventually producing the expected output

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900