A runner is preparing for a competition. Now he can run start kilometers, and in competitions he will need to run goal kilometers. There are days left before the competition. During the preparation for the competition, the athlete can increase the distance he runs by no more than 10% per day. You cannot train on the day of the competition.
Write a program that calculates whether the athlete will have time to prepare for the competition? Output True if it is in time and False if it is not in time.
I wrote the code:
class Runner (object):
def eval(self):
start = int(input("Enter how many kilometers your athlete can run:"))
goal = int(input("Enter how many kilometers your athlete should run:"))
days = int(input("Enter the number of days remaining before the competition:"))
while start<goal:
start +=start*10/100
days -=1
return days >=1
def loop(self):
value = self.eval()
print(value)
if __name__ == '__main__':
calc = Runner()
calc.loop()
But it gives me an error:Test Failed: Runner.eval() takes 1 positional argument but 2 were given
How can I fix this?
Murcielago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.