I have seen lots of answers to similar questions but none that are using OOP in python.
I need to write a piece of code that restricts the user to entering a number between 0 and 300 within a method, then call it later on.
This is the method used inside my class:
def setMinutes (self, minutes):
movieLength = str(0 - 300)
for movieLength in movieLength:
print('***debug: movieLength' + movieLength + 'submitted length' + minutes)
if minutes == movieLength:
self.minutes = minutes
return True
return False
and this is the code being used to call the function:
bolNeedMinutes = True
while bolNeedMinutes:
minutesInput = input("Enter length in minutes (0 - 300):")
if objMovie.setMinutes(minutesInput):
bolNeedMinutes = False
This works, however, the only valid input is zero. Any help / criticism is much appreciated !