import random
import os
# Function to generate a short story about a bear
def generate_bear_story(index):
bear_types = ["grizzly", "polar", "black", "panda", "brown"]
activities = ["fishing", "sleeping", "exploring", "playing", "hunting"]
places = ["forest", "mountain", "river", "field", "snowy plain"]
bear = random.choice(bear_types)
activity = random.choice(activities)
place = random.choice(places)
story = f"Story {index}: Once upon a time, a {bear} bear was {activity} in a {place}."
return story
# Directory to store the text files
directory = "bear_stories"
os.makedirs(directory, exist_ok=True)
# Generate and write 100 stories
for i in range(100):
story = generate_bear_story(i + 1)
with open(f"{directory}/story_{i+1}.txt", "w") as file:
file.write(story)
print("100 bear stories have been created.")