In this Python tutorial for beginners we will make a simple Capitals Quiz Game. It won't take us more than 10 minutes.
It will be a quiz about capital cities. The game will ask the player to type the name of the capital city of a certain country. When the user gets a question right, the game score goes up by one point. The player will be asked 10 questions by the game. After all of the questions have been asked, the game will print a message saying "Game Over" and the total score.
Let's start by figuring out what tools we'll need to make this game. First of all, we are going to need the print command because we are going to put a lot of things on the screen. Next, we'll need the input command because we'll be asking the user to type in some text. Now that we know how to use the for command and are going to ask the user a lot of questions, we won't be typing the same commands over and over again as we did in the last quiz game we made. We'll use the for command to do this. We will also need a data structure to keep track of the capitals and countries. Since our game will ask about 10 different countries, we won't make 10 different variables. We'll either use a dictionary or two lists, one for the countries and one for the capitals. The easiest way is to use a dictionary, so that's what we'll do for this game. The last tool we are going to use is the if-else statement to check if the user has entered the correct answer.
Let’s start at once.
#python #pythoncourse #pythongame
Watch video How to make a Python Capitals Quiz Game - Python for absolute beginners course online without registration, duration hours minute second in high quality. This video was added by user Programming With Nick 17 May 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 970 once and liked it 15 people.