When I get it right the first time I receive 'mwindow'. However, if I get it wrong once or more times I always get 'none' even if I get it right in the end.
def windows():
print('\n---Maintenence Window Config---\n')
mwdate = input('Enter the date for the maintenance window (3 letters, Mon, Tue, Wed, etc.) : ')
if len(mwdate) > 3 or len(mwdate) < 3:
print('Error, date must be 3 characters in length.')
windows()
else:
mwstart = input('Enter the time in 24h format for the beginning of the maintenance window (e.x. 04:00): ')
mwend = input('Enter the ending time of the maintenance window in 24h format (e.x. 04:30): ')
if int((mwstart and mwend).replace(':','')) < 1000 and (mwstart and mwend).startswith('0'):
mwindow = mwdate.capitalize()+mwstart+'-'+mwdate.capitalize()+mwend
return mwindow
else:
print('Error, be sure you prefix your window times with a 0 if they are earlier than 10:00.')
windows()
print(windows())
I do not believe this is a duplicate, because all of the other questions have issues by the way of forgetting to pass the tested value back into the function, but in my case this does not ap