-
Notifications
You must be signed in to change notification settings - Fork 509
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (22 loc) · 719 Bytes
/
app.py
File metadata and controls
33 lines (22 loc) · 719 Bytes
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
import random
def get_color(color_number=4):
# Making sure is a number and not a string
color_number = int(color_number)
switcher = {
0:'red',
1:'yellow',
2:'blue',
3:'green',
4:'black'
}
return switcher.get(color_number,"Invalid Color Number")
# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌
def get_allStudentColors():
example_color = get_color(1)
students_array = []
# ✅ ↓ your loop here ↓ ✅
for i in range (1, 11):
r= random.randint(0,3)
students_array.append(get_color(r))
return students_array
print(get_allStudentColors())