Computer Programming

Preview:

DESCRIPTION

Computer Programming. Week 6. Find your program entitled Maths Quiz and open it. The program should have consisted of 5 questions. The program should store the user’s name. The program should also store the score. - PowerPoint PPT Presentation

Citation preview

COMPUTER PROGRAMMING

Week 6

Find your program entitled Maths Quiz and open it.

The program should have

consisted of 5 questions The program should store

the user’s nameThe program should also

store the score

Finally, the program tells the user whether they’ve got the

question right or wrong.

Let’s make one final improvement on our program….

Score is 2 out of 5

Rank: Beginner

The final score of the user (after 5 questions) should fall into one of the following ranks.

Score is 1 out of 5

Rank: Noob

Score is 3 out of 5

Rank: Intermediate

Score is 4 out of 5

Rank: Maths Wizard

Score is 5 out of 5

Rank: Total Genius

If the final score (after 5 questions) is 1 out of 5, the final score message will read:

[name], you scored 1 out of 5. Your rank is NOOB

If the final score (after 5 questions) is 2 out of 5, the final score message will read:

[name], you scored 2 out of 5. Your rank is BEGINNNER

For example….

or….

If the final score (after 5 questions) is 5 out of 5, the final score message will read:

[name], you scored 5 out of 5. Your rank is TOTAL GENIUS

or….

To achieve this, we will once again use the If statement

if score == 1: print(user_name,', you scored: ', score,' out of 5. Your rank is: NOOB')

if score == 2: print(user_name,', you scored: ', score,' out of 5. Your rank is: BEGINNER') . . . . . .

This code must be entered at the bottom of your program.

As you can see in the above, there is no ‘else’ part. This is looked at in Year 11 Computing, but for our needs, 5 simple ‘if statements’ will help us achieve our objectives.

Edit your program now so that it gives the user a ‘rank’ according to their score.

NOTE! Not all possible scores have been ranked!!

Once you’ve discovered what the missing score is, edit your program to ‘rank’ this using a message or your own choosing.

Save your Maths Quiz game.

Hope you really enjoyed learning to program a computer…

…and hope you found PYTHON easy to learn!

Next class, you will be doing a Controlled Assessment.

You will be given the entire lesson to write a Python program which should solve a problem given to you by the teacher.

Good Luck!

Recommended