0

I'm trying to make an insurance program and in my program it asks you if you have any family history of Alzheimer's, Cancer, and/or, diabetes. If you have all three, you get 30 risk points, if you have none, you get 0 risk points. I am trying to validate the code by asking the same question if the person doesn't answer the question with a yes or no.

# Calculate Family Disease Scores
    
diabetes = ''

while True:
   diabetes = input('\n Do you have a family history of Diabetes? (Answer yes or no)')

   if diabetes == 'y' or 'yes':
      diabetesScore = 10
      break
   elif diabetes == 'n' or 'no':
      diabetesScore = 0
      break
   else: 
      print('Please answer Yes or No')
      continue
   
cancer = ''

while True:
   cancer = input('\n Do you have a family history of cancer? (Answer yes or no)')

   if cancer == 'y' or 'yes':
      cancerScore = 10
      break
   elif cancer == 'n' or 'no':
      cancerScore = 0
      break
   else: 
      print('Please answer Yes or No')
      continue
   
alzheimers = ''

while True:
   alzheimers = input('\n Do you have a family history of alzheimers? (Answer yes or no)')

   if alzheimers == 'y' or 'yes':
      alzheimersScore = 10
      break
   elif alzheimers == 'n' or 'no':
      alzheimersScore = 0
      break
   else: 
      print('Please answer Yes or No')
      continue
quamrana
  • 37,849
  • 12
  • 53
  • 71

0 Answers0