0

Solved #Relay race coding for unit 9 you are creating code for a relay race

players = ["Alice", "Bob", "Charlie", "David", "Eve", "Frank"] #Create 3 lists with 2 players each #Use slicing to create a list for Group 1 g1 = players [0:2] #Use slicing to create a list for Group 2 g2 = players [2:4] #Use slicing to create a list for Group 3 g3 = players [4:6] print("Group 1:") #display the 1st group print(g1) print("Group 2:") #display the 2nd group print(g2) print("Group 3:") #display the 3rd group print(g3)

25th Feb 2025, 4:59 PM
Christian Francis
Christian Francis - avatar
2 Antworten
+ 2
Missing closing square-bracket in line 11, it should be: g3 = players[4:6] Mistyped "Group :1" instead of "Group 1:" in line 13.
25th Feb 2025, 5:57 PM
Afnan Irtesum Chowdhury
Afnan Irtesum Chowdhury - avatar
0
Oh i see thank you
25th Feb 2025, 6:34 PM
Christian Francis
Christian Francis - avatar