Coders Packet

Program to guess the name of a country using Python

By Ayush Chauhan

Created a guessing game using python in which the player will have to guess the letters that comes in the name of a country that the computer generates randomly.

Country Guessing Game

It is a very simple guessing game made using python programming language.

The logic behind the game is as follows:

The computer randomly selects a letter (which is kept secret from the player) from a list of predefined countries.This capability is provided by the random module which is used initially.

The Guessing Game:

In this, a random letter (country's name) is taken from the list of countries that was predefined (in the code) and the player will only get limited number of trials to guess the name of the country and win the game eventually.

If the letter guessed by the user is correct, then that index of that letter is made visible to the player so as to assist the player (a bit). To make it easy the player has the number of trails equal to the the length of the word plus 2. For instance, if the country' name is "Sweden" (the number of letter in the word is 6) so the player will get 6+2 = 8 trials.


Download Complete Code


No comments yet