+ 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??
3 Réponses
+ 6
It return a value. But you did not print that.
print(ductTape(height,width))
+ 4
Vadivelan so, simply calling a function that has return statement in it doesnt print anything. We have to print the returned value. Thanks.
+ 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.