View the live project here
This image is from Am I responsive
This Story-Vault is a command-line based application which allows the user to choose from a selection of stories using the input keyboard. The app was created so the user can use a variety of different nouns and verbs to create a story. The story is extremely user friendly and is aimed at adults and children who are able to read (6 years +)
The program was created with simplicity in mind. the only thing the user has to do is input their name, numbers 1-4 and yes/no. This means that it 's user friendly to anyone who can read and type English.
The ideal client for this program is:
- Someone who is English speaking with full literacy skills
- Someone who likes to read
- Someone who enjoys an interactive experience
- Someone young
- 38F - I found the program quite interesting and I liked the selection of stories available.
- 9M - I would love to have an option to create a game by choosing the words. The jokes were funny
- 60F - I loved using the program and it left a smile on my face. Nice and easy to use and the jokes were hillarious
The program was outputted as a terminal therefore it's a single page application. Python was used to generate the data and stories. I have included a flow-chart to illustrate the program's process.
To achieve the goal of the project I included the following:
- A list of 3 stories and a selection of jokes
- A personal greeting at the beginning
- The user can choose another story after choosing variables for the current story
- The option to end the program at any time.
The program features a variety of python functions that make up each story. Eg. for the Hero story, the Christmas Story and the Sporting Story. Also the jokes are containing within its own python function. There is a also a python function to ask for the user's name. To recall any of the functions, I created a main_function() The conditional ststement decides which function is called or in this case which story is chosen.
To avoid having to repeat code, a dictionary function. This function takes 3 input; the name of the list, the title message and the input message. This function also checks for any index error and value error using a try and catch statement.
Overall the program uses quite a simple design and the output text is clear and concise. There is no ambiguity for the user.
For this project I used the following software:
- Github
- Sketch ( To create the flowchart)
- VSCode Desktop (to create the initial code)
- Python tutor
- Heroku (To show the python program as a web app)
- MacOSX on MacbookPro 13
This project was deployed as a web application using Heroku. The project was also pushed to GitHub by using GitPod and Git commands.
To deploy this page to Heroku from GitHub, do the following:
- Create an account on Heroku
- Click ‘Create new App’ from the top menu
- Choose a name for the app and then choose the region as Europe
- In settings, add a build pack for Python and Node.js
- Click on Config Vars and add ‘Port’ for key and ‘8000’ for value
- Click save changes 7 . Click on the deploy tab and then click connect to GitHub
- Search for repository name and then once this is done, click connect.
- Deploys can be done manually or automatically. For this project, click ‘automatic deploys’
- After the project has been successfully deployed, click on ‘open app’ at the top of the page to open the newly created web app.
Starting the program brings up an input message asking to input your name. This value is taken as a string so both letters and numbers can be inputted. After the name is inputted the program says 'Hello Name' welcome to the story vault.
After this all of the story options are printed with the corresponding number proceeding it
The user is requested to input the value next to the story. As soon as this is done the program lists the variables for each list as part of the story. Again the user is requested to input corresponding number next to the variable.
The program asks for many different variables for the story.
The user can create the story exactly how they want it. rf
Eventually after the user inputs the values for each variable from each list the story prints with the variables.
If the user inputs a value greater than the index or provides a value that can't be cast to an integer, then the code will return a invalid error. The exception for ValueError and IndexError are thrown in this case.
After each story the program asks the user if they would like another story. This was created using the function item_selecttion() and a list of possible options was passed into the function.
Option 4 brings up a list of jokes that the user can choose. After the user has chosen the chosen joke the program asks if they would like another joke which executes joke_selection() function if the user says yes.
If the user chooses not to display another joke the program then asks if the user would like to read another story. In this case the code executes main_function().
The program runs efficiently with no issues. The testing confirms this
The biggest problem faced for this project was deciding how to deal with users who inputted a non-integer value. I asked for help from my fellow classmates on Slack and then my mentor. Both suggested that I use a 'while' loop and then inside this loop use 'try' and 'catch' method. I experimented with a number of variations of this code before getting something that worked efficiently.
I had to find a way to truncate the number of characters in each line before the program passed the pep8 validation. I searched Google and discovered that putting a \ allows you to carriage return to the next line without upsetting the syntax.
Other than those listed above I found the code to be quite simple.
The code has been fully validated with Pep8online and this returned a result of no issues.
- I would like to thank my mentor Guido Cecilio for his guidance throughout the whole project
- I found out the enumerate code from the following link: Stackoverflow Code
- I used Youtube as a help for this project