## ~ Create a Bingo Game - store scores to file - Python

### Creating a Bingo type game - saving scores (no.of.tries) to file.

This program makes use of the creation of a random number as well as simple file handling, such as writing the scores to file, and then sorting the file

Example of creation of a random number

```#generate a random number
import random #this needs to go at the start of your code
bingo=(random.randint(0,20)) #generate a random number from 0 to 20
```

### Challenge -Create a Bingo type game, allowing the user tries, save scores(tries) to file.

Read the task instructions that are included in the comments in the code, and then get started!

You can either edit and code online in repl.it or alternatively, you can simply cut and paste the below into your own python file

Solve the challenge on repl.it

### Code

```""" ==============TASK

First, Create a Menu as below:
1........Play Game
2........View Players and Scores record
3........Quit

1. Get the computer to generate a random number between 1 and 20
2. Ask the user to enter their full name
3. The user can then start to guess what the number is (their tries are recorded)
4. On correctly guessing the randomly generated number, their final tries are recorded
5. The user's name and no. of tries are stored to a file in the format:

user's name      no.of.tries
Joe Bloggs             5
Kara Smith           17

6. Sort and display the high scores in ascending order (lowest no.of tries first)

"""

#generate a random number see below:
#

print("""
print("+-------------------------------------+")
print("|  Please select an option:                     |")
print("| 1 - Play Game                                 |")
print("| 2 - View Scores                               |")
print("| 3 - Quit                                      |")
print("----------------------------------------")

```

Systems Life Cycle (in a nutshell): Analyse - Design - Create - Test - Evaluate. Designing something or writing out some pseudocode before you actually write code is always a good idea! Get in to the habit of doing so! You can draw your flowchart here and screenshot it.

A sample flow chart (design) for this particular challenge could look like:

Each challenge section below provides an online drawing tool where you can dynamically create flowcharts. Screenshot them into your presentation for submission.