Function not returning anything | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Function not returning anything

https://www.sololearn.com/coach/38?ref=app While solving above mentioned code coach challenge, I wrote following codelines-- height = int(input()) width = int(input()) '''this code takes height and width of a door respectively as input and determines the number of ductTape rolls to be bought to cover the door with ductTape on both sides. areaOfTape is given as 10.''' def ductTape (a, b): area = a * b*2 areaOfTape= 10 import math tapeNumber = math.ceil(area/areaOfTape) return tapeNumber ductTape(height,width) It's not returning any output. What's wrong in this code??

27th Dec 2020, 3:02 AM
CHANDAN ROY
CHANDAN ROY - avatar
3 Answers
+ 6
It return a value. But you did not print that. print(ductTape(height,width))
27th Dec 2020, 3:10 AM
Vadivelan
+ 4
Vadivelan so, simply calling a function that has return statement in it doesnt print anything. We have to print the returned value. Thanks.
27th Dec 2020, 3:13 AM
CHANDAN ROY
CHANDAN ROY - avatar
+ 3
CHANDAN ROY One more thing always import libraries at the starting of the program. Reason - You can use anywhere. No need to import again and again in every methods.
27th Dec 2020, 5:23 AM
A͢J
A͢J - avatar