File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
[2.2] Fundamentals Exam - Exercises/[1.1] Mid Exam Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ def jump_neighborhood (length_delivery ):
2
+ global jump_position
3
+
4
+ jump_position += length_delivery
5
+ if jump_position >= len (neighborhood ):
6
+ jump_position = 0
7
+
8
+ if neighborhood [jump_position ] == 0 :
9
+ print (f"Place { jump_position } already had Valentine's day." )
10
+
11
+ else :
12
+ neighborhood [jump_position ] -= 2
13
+ if neighborhood [jump_position ] == 0 :
14
+ print (f"Place { jump_position } has Valentine's day." )
15
+
16
+
17
+ neighborhood = [int (n ) for n in input ().split ("@" )]
18
+
19
+ jump_command = input ()
20
+ jump_position = 0
21
+
22
+
23
+ while jump_command != "Love!" :
24
+ jump_command = jump_command .split ()
25
+ jump_neighborhood (int (jump_command [1 ]))
26
+
27
+ jump_command = input ()
28
+
29
+ print (f"Cupid's last position was { jump_position } ." )
30
+
31
+ if sum (neighborhood ) == 0 :
32
+ print ("Mission was successful." )
33
+ else :
34
+ fail_count = neighborhood .count (0 )
35
+ print (f"Cupid has failed { len (neighborhood ) - fail_count } places." )
You can’t perform that action at this time.
0 commit comments