y = 5
def my func():
y = a 5
a = 2
print("y="
print("a + y =
return a + y
"a =", a)
a + y)
2
y)
print("y =", y, "a =", a)
print(myfunc())
print("y =", y, "a =", a)
What is wrong with the following function defini
Answers
Answered by
1
Answer:
a function name must not have a space between it
Explanation:
yoy cannot write :"def my func()" instead you can write "def my_func()" or "def my$func()" or "def myFunc()"
def my_func() is said to be written in python case
def myFunc() is said to be written in camel case
also the intendation is wrong
also when you want the value of a variable to be printed, you add the + operator. Like to print the value of y, you write:
print("y= "+str(y)
go to this site to get a detailed tutorial on python: www.w3schools.com
Similar questions