Advertisement
Guest User

ifs

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. def quiz():
  2. score = 0
  3. answer1 = input('What type of tree do dates grow on? \na - Palm trees; \nb - Fir trees; \nc - Hand trees? \n: ')
  4. if answer1 == 'a':
  5. print('CORRECT!')
  6. score = score + 1
  7. else:
  8. print('INCORRECT')
  9. answer2 = input('What is the name of the highest Mountain in Africa? \na - Mount Kenya; \nb - Mount Kilimanjaro; \nc - Mount Wanahakalugi? \n: ')
  10. if answer2 == 'b':
  11. print('CORRECT!')
  12. score = score + 1
  13. else:
  14. print('INCORRECT')
  15. total = int(score)
  16. print('That is the end of the quiz. You scored ', total,'/2')
  17.  
  18. phrase = input('Talk to me >')
  19. if phrase == 'hi' or phrase == 'hey':
  20. print('Hello')
  21. elif phrase == 'What is your name?' or phrase == 'What\'s your name?':
  22. print ('Marvin')
  23. elif phrase == 'How old are you?' or phrase == 'Are you old?':
  24. print ('A robot never tells his age!')
  25. else:
  26. print('Sorry I do not understand \'' + phrase + '\'')
  27. phrase2 = input('How are you doing? : ')
  28. if phrase2 == 'good' or phrase2 == 'great':
  29. print('I am glad to hear that you are ' + phrase2)
  30. else:
  31. print('Sorry that you are just ' + phrase2)
  32. phrase3 = input('Would you like to do a short quiz - yes or no? : ')
  33. if phrase3 == 'yes':
  34. print('GREAT!')
  35. quiz()
  36. else:
  37. print('Ok')
  38. print('Bye')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement