-
Notifications
You must be signed in to change notification settings - Fork 133
/
16_sorting_hat_2.py
91 lines (70 loc) · 1.77 KB
/
16_sorting_hat_2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Sorting Hat 🧙♂️
# Codédex
gryffindor = 0
hufflepuff = 0
ravenclaw = 0
slytherin = 0
print('===============')
print('The Sorting Hat')
print('===============')
# ~~~~~~~~~~~~~~~ Question 1 ~~~~~~~~~~~~~~~
print('Q1) Do you like Dawn or Dusk?')
print(' 1) Dawn')
print(' 2) Dusk')
answer = int(input('Enter answer (1-2): '))
if answer == 1:
gryffindor += 1
ravenclaw += 1
elif answer == 2:
hufflepuff += 1
slytherin +=1
else:
print('Wrong input.')
# ~~~~~~~~~~~~~~~ Question 2 ~~~~~~~~~~~~~~~
print("\nQ2) When I'm dead, I want people to remember me as:")
print(' 1) The Good')
print(' 2) The Great')
print(' 3) The Wise')
print(' 4) The Bold')
answer = int(input('Enter your answer (1-4): '))
if answer == 1:
hufflepuff += 2
elif answer == 2:
slytherin += 2
elif answer == 3:
ravenclaw += 2
elif answer == 4:
gryffindor += 2
else:
print('Wrong input.')
# ~~~~~~~~~~~~~~~ Question 3 ~~~~~~~~~~~~~~~
print('\nQ3) Which kind of instrument most pleases your ear?')
print(' 1) The violin')
print(' 2) The trumpet')
print(' 3) The piano')
print(' 4) The drum')
answer = int(input('Enter your answer (1-4): '))
if answer == 1:
slytherin += 4
elif answer == 2:
hufflepuff += 4
elif answer == 3:
ravenclaw +=4
elif answer == 4:
gryffindor += 4
else:
print('Wrong input.')
print("Gryffindor: ", gryffindor)
print("Ravenclaw: ", ravenclaw)
print("Hufflepuff: ", hufflepuff)
print("Slytherin: ", slytherin)
# Bonus Part
most_points = max(gryffindor, ravenclaw, hufflepuff, slytherin) # We'll learn about the max() function in Chapter 6
if gryffindor == most_points:
print('🦁 Gryffindor!')
elif ravenclaw == most_points:
print('🦅 Ravenclaw!')
elif hufflepuff == most_points:
print('🦡 Hufflepuff!')
else:
print('🐍 Slytherin!')