Guest User

Untitled

a guest
Jun 26th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1. import random
  2.  
  3. vehicleQ = '''
  4. The 1st category is vehicles. What is: 1 vehicle you would like:
  5. Another vehicle you would like:
  6. A final vehicle you would like:
  7. What is a vehicle that you would hate to have (e.g: a trolley!)?:
  8. Another vehicle you'd hate to have:
  9. The final vehicle you wouldn't want: '''
  10.  
  11. jobsQ = '''
  12. Now it's jobs! What is: 1 job you'd like:
  13. 2nd job you'd like:
  14. 3rd job you'd like:
  15. A job you'd absolutely hate to have:
  16. 2nd job you'd hate:
  17. 3rd job you'd hate:'''
  18.  
  19. spouseQ = '''
  20. Now it's husbands/wives! Who is: 1 spouse you'd like:
  21. ...another:
  22. and a final one:
  23. And a spouse you'd absolutely hate to have:
  24. 2nd spouse you'd hate:
  25. 3rd spouse you'd hate:'''
  26.  
  27. kidsQ = '''
  28. Now it's kids! What is: a number of kid's you'd like to have:
  29. 2nd number:
  30. Final number you'd like:
  31. A number of kids you'd absolutely hate to have:
  32. 2nd number you'd hate:
  33. 3rd number you'd hate:'''
  34.  
  35. # ....
  36. # more questions sets formatted like above
  37. # ...
  38.  
  39. def processQuestions(questionSet):
  40.     answers = []
  41.     for question in questionSet.split('\n')[1:]:
  42.         answer = raw_input(question)
  43.         answers.append(answer)
  44.     return answers
  45.  
  46. def printResults(randomAns):
  47.     print
  48.     print '''You will drive/ride a/an: {0}
  49. You will be a: {1}
  50. You'll be married to: {2}
  51. You will have: {3} kids
  52. '''.format(*randomAns)
  53.  
  54. questionSets = [vehicleQ,jobsQ,spouseQ,kidsQ]
  55. randomAnswers = []
  56. for qSet in questionSets:
  57.     qSetAnswers = processQuestions(qSet)
  58.     randomAns = random.choice(qSetAnswers)
  59.     randomAnswers.append(randomAns)
  60. printResults(randomAnswers)
Advertisement
Add Comment
Please, Sign In to add comment