Advertisement
cocons13

Volleyball Game Code

Jun 23rd, 2023 (edited)
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | Source Code | 0 0
  1. import random
  2.  
  3. teamA_score = 0
  4. teamB_score = 0
  5.  
  6. while True:
  7. random_number = random.randint(0, 99)
  8.  
  9. if random_number < 50:
  10. teamA_score += 1
  11. else:
  12. teamB_score += 1
  13.  
  14. if (teamA_score >= 25 or teamB_score >=25) and abs(teamA_score - teamB_score) >= 2:
  15. break
  16.  
  17. if teamA_score > teamB_score:
  18. winning_team = "Team A"
  19. else:
  20. winning_team = "Team B"
  21.  
  22. print("Final Score:")
  23. print("Team A:", teamA_score)
  24. print("Team B:", teamB_score)
  25. print("Winning Team:", winning_team)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement