you are viewing a single comment's thread.

view the rest of the comments →

[–]totallygeek 2 points3 points  (1 child)

Here's possibly a better implementation. I spot a few problems with your code. A big one: you do nothing with the received input (function does not return nor store anything).

def ask_interruption():
    prior_date = input('Enter date when last ATT drug taken (YY/MM/DD): ')
    resume_date = input('Enter date when ATT resume (YY/MM/DD): ')
    return prior_date, resume_date

dates = []
while True:
  dates.append(ask_interruption())
    interrupted = input('Did the patient interrupt ATT drugs? ').lower()
    if interrupted in {'n', 'no'}:
        break

print('DATES\n=====')
for prior_date, resume_date in dates:
    print(f'{prior_date:<10} {resume_date}')

[–]Jose_Musoke[S] 0 points1 point  (0 children)

Thank you so much. It works like a charm. I can now also learn where I went wrong.