0
What is the error in this code?
2 Answers
+ 3
"""
there are many mistakes:
+ missuse of int... python have duck typing : you don't have to declare variable type, but you have to cast input() returned value to number to be able to do math with it
+ confusing 'count' var: you need a var to store height reached and another one for day count
"""
"""Q. A man fall into a well
N is a input as the depth of the well
The mam climbs 4m and slips 3m everyday.
What is the total days needed by the man to climb the well?"""
#count = int
#n = int
#n = input ("Enter the number: ")
n = int(input ("Enter the number: "))
count = 0
# added:
height = 0
#while count <= n:
while height < n:
#count = count +4
count = count +1 # count days
height = height +4 # count height reached
#if count == n:
if height >= n:
print("No of days are:- ",count)
else:
#count=count-3
height=height-3
#what is the bug?
+ 1
thanks bro but you corrected my code but still the answer remains wrong.