View difference between Paste ID: kT1QePZU and xuY8K5vw
SHOW: | | - or go back to the newest paste.
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
	#function returns list of answers to a question set
41
	answers = []
42
	for question in questionSet.split('\n')[1:]:
43
		answer = raw_input(question)
44
		answers.append(answer)
45
	return answers
46
47
def printResults(randomAns):
48
	#unpacking randomAns tuple to print results
49
	print
50
	print '''You will drive/ride a/an: {0}
51
You will be a: {1}
52
You'll be married to: {2}
53
You will have: {3} kids
54
'''.format(*randomAns)
55
56
#for each question set...
57
#... get answers to questions
58
#... select a random answer (*)
59
#... Add (*) to a list used to store random answers from each question set
60
61
questionSets = [vehicleQ,jobsQ,spouseQ,kidsQ]
62
randomAnswers = []
63
for qSet in questionSets:
64
	qSetAnswers = processQuestions(qSet)
65
	randomAns = random.choice(qSetAnswers)
66
	randomAnswers.append(randomAns)
67
printResults(randomAnswers)