File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
[2.2] Fundamentals Exam - Exercises/[1.2] Mid Exam - Retake Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 12
12
print ("The lift has empty spots!" )
13
13
14
14
print (* current_wagons )
15
+
16
+ # Different solution:
17
+
18
+ people = int (input ())
19
+ max_people = 4
20
+ current = [int (num ) for num in input ().split ()]
21
+
22
+ for el in range (len (current )):
23
+ if people >= 4 :
24
+ if current [el ] == 0 :
25
+ current [el ] += 4
26
+ people -= 4
27
+ else :
28
+ c_num = max_people - int (current [el ])
29
+ current [el ] += c_num
30
+ people -= c_num
31
+ else :
32
+ current [el ] += people
33
+ people = 0
34
+
35
+ check_nums = [int (num ) for num in current if num != 4 ]
36
+
37
+ if people == 0 and check_nums :
38
+ print ("The lift has empty spots!" )
39
+ print (* current , sep = " " )
40
+ if people != 0 and not check_nums :
41
+ print (f"There isn't enough space! { people } people in a queue!" )
42
+ print (* current , sep = " " )
43
+ if people == 0 and not check_nums :
44
+ print (* current , sep = " " )
You can’t perform that action at this time.
0 commit comments