0

What’s wrong

What’s wrong here: def area(leagth=3,hight=1): area=leagth * hight area=(leagth= 3,hight=4) print(area)

12th Jun 2024, 9:18 AM
Jay Zhang
5 Respuestas
+ 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.
12th Jun 2024, 1:13 PM
STE4LPH
STE4LPH - avatar
+ 1
I would like to suggest you to take introduction to python course.Here you will learn about functions.
12th Jun 2024, 9:28 AM
You
You - avatar
0
Code in correct formate:-👇 def area(height = 3, width = 1): return height*width print(area(3,1))
12th Jun 2024, 9:24 AM
You
You - avatar
0
What do you mean by return
12th Jun 2024, 9:25 AM
Jay Zhang
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)
12th Jun 2024, 3:53 PM
Ramatulasi Kundrapu
Ramatulasi  Kundrapu - avatar