Skip to content

Commit 6da65d2

Browse files
Merge pull request #1906 from shraddha761/storyScript
Story generator script is added
2 parents 3d83095 + 11470ca commit 6da65d2

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

SCRIPTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
| 96\. | Sorting Techniques | Sorting techniques are scripts that arrange a collection of data elements in a particular order, typically ascending or descending. | [Take Me](./Sorting%20Techniques/) | [Himanshu Agarwal](https://github.com/himanshu-03)
101101
| 99\. | File Organizer script | A File Organizer script is a program or script that automates the process of organizing files within a directory or multiple directories | [Take Me](./File Organizer script/) | [Abhinav kumar](https://github.com/Abhinavcode13)
102102
| 100\. | File Encryption/Decryption script | A File Organizer script is a program or script that automates the process of organizing files within a directory or multiple directories | [Take Me](./File Encryption/Decryption script/) | [Abhinav kumar](https://github.com/Abhinavcode13)
103-
| 101\. | Scientific Calculator | This python program will help to solve the hardest problems of trigonometry, exponents functions, logarithmic functions, etc. in very easy way. This program has a best User interface of the scientific calculator and provide a best user experience | [Take Me](./Scientific_Calculator) | [Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
104-
| 102\. | Chess Game | Chess Game is created using PYTHON script that provides user a interactive platform to play chess game. This program will create a interactive GUI of chess board for the user. Directly started in the terminal. | [Take Me](./Chess-Game/) | [Avdhesh Varshney](https:github.com/Avdhesh-Varshney)
103+
| 101\. |Story Generator | This script randomly selects a character, setting, action, and conclusion from predefined lists and generates a story using these elements. | [Take Me](./Story_Generator/story_generator.py) | [Shraddha Singh](https://github.com/shraddha761)
104+
| 102\. | Scientific Calculator | This python program will help to solve the hardest problems of trigonometry, exponents functions, logarithmic functions, etc. in very easy way. This program has a best User interface of the scientific calculator and provide a best user experience | [Take Me](./Scientific_Calculator) | [Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
105+
| 103\. | Chess Game | Chess Game is created using PYTHON script that provides user a interactive platform to play chess game. This program will create a interactive GUI of chess board for the user. Directly started in the terminal. | [Take Me](./Chess-Game/) | [Avdhesh Varshney](https:github.com/Avdhesh-Varshney)
105106

Story_Generator/Readme.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Story Generator
2+
3+
This is a simple Python script that generates random stories by combining predefined characters, settings, actions, and conclusions. Each time the script is run, it generates a unique story.
4+
5+
## How to Use
6+
7+
1. Make sure you have Python installed on your system.
8+
2. Clone or download this repository to your local machine.
9+
3. Open a terminal or command prompt and navigate to the project directory.
10+
4. Run the script using the following command:
11+
5. The script will generate a random story and display it in the terminal.
12+
13+
## Customization
14+
15+
You can customize the story generator by modifying the predefined lists in the script. Here's what each list represents:
16+
17+
- `characters`: A list of characters that can be the protagonist or main characters of the story.
18+
- `settings`: A list of different settings or locations where the story can take place.
19+
- `actions`: A list of actions or events that can happen in the story.
20+
- `conclusions`: A list of possible endings or conclusions to the story.
21+
22+
23+
Each story generated will have a similar structure but with different elements randomly chosen from the lists.
24+
25+

Story_Generator/story_generator.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import random
2+
3+
# Lists of story elements
4+
characters = ['Alice', 'Bob', 'Charlie', 'Eve']
5+
settings = ['a small town', 'a mysterious castle', 'a futuristic city', 'an enchanted forest']
6+
actions = ['discovered a hidden treasure', 'solved a puzzling mystery', 'overcame their fears', 'saved the world']
7+
conclusions = ['and they lived happily ever after.', 'and they vowed to continue their adventures.', 'and they returned home, forever changed.']
8+
9+
# Generate a random story
10+
def generate_story():
11+
character = random.choice(characters)
12+
setting = random.choice(settings)
13+
action = random.choice(actions)
14+
conclusion = random.choice(conclusions)
15+
16+
story = f"Once upon a time, {character} found themselves in {setting}. They {action} {conclusion}"
17+
18+
return story
19+
20+
# Generate and print a story
21+
story = generate_story()
22+
print(story)

0 commit comments

Comments
 (0)