Skip to content

Commit 8f5fa95

Browse files
authored
Zoombinis.py
1 parent d06f742 commit 8f5fa95

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Zoombinis/Zoombinis.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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()

0 commit comments

Comments
 (0)