-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcups.py
More file actions
24 lines (21 loc) · 699 Bytes
/
cups.py
File metadata and controls
24 lines (21 loc) · 699 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
# Cups
# Author: Debbie Macrohon
# Description: Using Python's dictionary structure
# and sorting the keys for the right solution
rounds = int(input()) # initial input = number of rounds
array = [""]*rounds # initializing an empty array
arranged = {} # initializing an empty dictionary
for i in range (0, rounds):
array[i] = input()
for i in range (0, rounds):
inputs = array[i].split()
# using a try-catch block to input radius and color
try:
num = int(inputs[1])
color = inputs[0]
except:
num = int(inputs[0])/2 # dividing number by 2 if number is in front of color
color = inputs[1]
arranged[num] = color
for key in sorted(arranged):
print("{} ".format(arranged[key]))