0
What’s wrong
What’s wrong here: def area(leagth=3,hight=1): area=leagth * hight area=(leagth= 3,hight=4) print(area)
5 Antworten
+ 2
I'll explain to you
In order to print values you can use the print call to print the result by removing area = length * height
and putting print(area)
You also have the option of being able to return values without printing them just by calling the function, which in this case is area()
In your code there is a bad practice to define the corresponding values you should put it like this
def area (length, height):
return length * height
area(length = 3, height = 4)
in which it will return its result of type integer
Keep learning, the more you fail, the better you will be, I will be willing to help you.
+ 1
I would like to suggest you to take introduction to python course.Here you will learn about functions.
0
Code in correct formate:-👇
def area(height = 3, width = 1):
return height*width
print(area(3,1))
0
What do you mean by return
0
You use named named keyword to take variables in keyboard, the parameter passing in the function.
def area(length, height):
a=length*height
print(a)
area(length=3, height=4)