~ 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


""" ==============TASK

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

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:

def mainmenu():
=========MAIN MENU========""")
    print("|  Please select an option:                     |")
    print("| 1 - Play Game                                 |")
    print("| 2 - View Scores                               |")
    print("| 3 - Quit                                      |")


Code your solution here

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:

Flowchart: Python program to get the Fibonacci series between 0 to 50
Each challenge section below provides an online drawing tool where you can dynamically create flowcharts. Screenshot them into your presentation for submission.

Solutions & Answers

Answers /Solutions in the "members area" drive under: "Solve and Learn >>SOLUTIONS"

Testing Table

You may want to read a little about Testing first. A teacher may go through some examples with you. Feel free to fill in the test table here, and screenshot it in to your powerpoint. Testing is absolutely essential once you have created a program!
Test No. Description Test Data(input) Expected Outcome Actual Outcome Further Action?
Coming soon!