File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ import random
2
+
3
+ # Constants
4
+ ZOOMBINIS_COUNT = 16
5
+ ZOOMBINIS_PER_TEAM = 8
6
+
7
+ # Functions
8
+ def setup_teams ():
9
+ teams = []
10
+ for i in range (2 ):
11
+ team = []
12
+ for _ in range (ZOOMBINIS_PER_TEAM ):
13
+ team .append (random .randint (1 , 4 ))
14
+ teams .append (team )
15
+ return teams
16
+
17
+ def display_teams (teams ):
18
+ for i , team in enumerate (teams , start = 1 ):
19
+ print (f"Team { i } : { team } " )
20
+
21
+ def main ():
22
+ print ("Welcome to Zoombinis!" )
23
+ teams = setup_teams ()
24
+
25
+ while True :
26
+ display_teams (teams )
27
+ team_choice = int (input ("Select a team (1 or 2): " ))
28
+
29
+ if team_choice < 1 or team_choice > 2 :
30
+ print ("Invalid team choice. Please select 1 or 2." )
31
+ continue
32
+
33
+ selected_team = teams [team_choice - 1 ]
34
+ zoombini_choice = int (input ("Select a Zoombini (1-8): " ))
35
+
36
+ if zoombini_choice < 1 or zoombini_choice > 8 :
37
+ print ("Invalid Zoombini choice. Please select a number between 1 and 8." )
38
+ continue
39
+
40
+ zoombini = selected_team [zoombini_choice - 1 ]
41
+ print (f"Selected Zoombini: { zoombini } " )
42
+
43
+ play_again = input ("Do you want to play again? (y/n): " )
44
+ if play_again .lower () != "y" :
45
+ print ("Thanks for playing Zoombinis!" )
46
+ break
47
+
48
+ if __name__ == "__main__" :
49
+ main ()
You can’t perform that action at this time.
0 commit comments