forked from codedex-io/python-101
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSorting_Hat.py
More file actions
91 lines (73 loc) · 1.69 KB
/
Sorting_Hat.py
File metadata and controls
91 lines (73 loc) · 1.69 KB
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
gryffindor = 0
hufflepuff = 0
ravenclaw = 0
slytherin = 0
print('The Sorting Hat')
# ~~~~~~~~~~~~~~~ Question 1 ~~~~~~~~~~~~~~~
answer = int(input("""
Do you like Dawn or Dusk?
1) Dawn
2) Dusk
Enter answer (1-2): """))
if answer == 1:
gryffindor += 1
ravenclaw += 1
elif answer == 2:
hufflepuff += 1
slytherin +=1
else:
print('Wrong input.')
# ~~~~~~~~~~~~~~~ Question 2 ~~~~~~~~~~~~~~~
answer = int(input("""
When I'm dead, I want people to remember me as:
1) The Good
2) The Great
3) The Wise
4) The Bold
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("""
Which kind of instrument most pleases your ear?
1) The violin
2) The trumpet
3) The piano
4) The drum
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)
most_points = max(gryffindor, ravenclaw, hufflepuff, slytherin) # We'll learn about max() in the Functions chapter
if gryffindor == most_points:
print('🦁 Gryffindor!')
elif ravenclaw == most_points:
print('🦅 Ravenclaw!')
elif hufflepuff == most_points:
print('🦡 Hufflepuff!')
else:
print('🐍 Slytherin!')