Building a Random Name Generator application.
In this project, you will be building a text-based user interface that will take a input and output a list of random names from a pre-defined list.
- User inputs
- Validating inputs
- Importing packages
- Documenting code
- Writing functions
- Control flows
- Printing outputs to the user
- Using random functionality in Python
- Basic structure of Python Scripts
This application will simulate randomly generating names from a pre-defined list. A use case could be: a set of new parents can't choose a name from a shortlist. Why not use Python to help!
The application will:
- Take a user input of shortlist names.
- Take a second user input of how many names they want randomly selected from that shortlist. This should be a positive integer. The app should check if the input is valid.
- Print to the user the randomly selected names.
Feel free to structure the application however you see fit, but here is a project structure recommendation. If you have experience with pseudocode or flowcharts, I would recommend mapping out the project using these tools before you start any programming.
I would also recommend using Visual Studio Code as your editor, but this is personal preference. Make sure you implement coding standards and Pythonic style in the application!
Suggested Structure:
- Contain all code in one main.py file. Could also be a .ipynb file.
- A README file consisting of project documentation. I would recommend a .md file.
- Read the user's input using Python's inbuilt input() function i.e. multiple calls to input().
- A user-defined function that validates and parses the user's input. Think of a appropriate function name and appropriate checks.
- A user-defined function that uses Python's random package to select the names from the shortlist. Think of a appropriate function name.
- Prints the shortlisted names to the user.