Untitled
unknown
plain_text
9 months ago
658 B
12
Indexable
import random
import time
def shoot(chosen_points):
"""Simulate a shot based on points chosen."""
chance = random.random()
if chosen_points == 2:
return 2 if chance < 0.55 else 0 # 55% chance for 2 points
elif chosen_points == 3:
return 3 if chance < 0.35 else 0 # 35% chance for 3 points
def free_throw():
"""Simulate a free throw."""
return 1 if random.random() < 0.75 else 0 # 75% chance to score
def player_turn(player_name):
print(f"\n{player_name}'s turn!")
choice = input("Choose your shot (2 or 3 points, or F for free throw): ").strip().upper()
if choice == 'F':
score = free_throw(_Editor is loading...
Leave a Comment