project
project
import time
def get_random_weather():
weather_list = ["foggy", "rainy", "stormy", "windy", "sunny", "cloudy"]
return random.choice(weather_list)
def creature_encounter(score):
creatures = ["a giant snake", "a ghost pirate", "a wild boar", "a talking
monkey", "a swarm of bats"]
creature = random.choice(creatures)
print_with_delay(f"You suddenly encounter {creature}!")
return score
def explore_treasure_room(score):
outcome = random.choice(["reward", "penalty"])
if outcome == "reward":
amount = random.randint(10, 20)
print_with_delay(f"You found treasure worth {amount} points!")
score += amount
else:
amount = random.randint(5, 15)
print_with_delay(f"A trap activates! You lose {amount} points.")
score -= amount
return score
def play_game():
total_score = 0
total_score = creature_encounter(total_score)
print_with_delay(f"Your score is now {total_score}")