Ads

ca-app-pub-5276613537702019/9440371124

Dorm little bull

import random def play_cricket(): print("Welcome to Python Cricket Game!") print("Instructions: Choose a number between 1 to 6. If it matches with the computer's number, you're OUT!") score = 0 while True: try: player = int(input("Enter your run (1-6): ")) if player < 1 or player > 6: print("Please enter a number between 1 and 6.") continue except ValueError: print("Please enter a valid number.") continue computer = random.randint(1, 6) print(f"Computer bowled: {computer}") if player == computer: print("You're OUT!") print(f"Your final score: {score}") break else: score += player print(f"Good shot! Your current score: {score}") print("-" * 30) play_cricket()

Post a Comment

0 Comments