Click here to Skip to main content
15,897,032 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:

Python

what is the value in python
Posted
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"
 
Share this answer
 
This fix your syntax errors
Python
def Avg (a,b):
  return a+b/2

print (Avg (1,2))

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

print (Avg (1,2))

eventually producing the expected output
1.5 
 
Share this answer
 

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