Python: A Very Simple Guessing Game Dedicated For Beginners

Submitted by: 
Visitors have accessed this post 2345 times.

In this tutorial we will create a very simple Guessing Game Using Python Programming. Python lets you work more quickly than other programming languages.It is very easy to learn syntax emphasizes readability and reduces time consuming in developing. In Python you don't have to worry about a miss semi colon, because it is not necessarily needed in python. So let now start the coding...

Getting started:
First you will have to download & install the Python IDLE's, here the link for the Integrated Development And Learning Environment for python

After you installed the Pythons IDLE's, run the IDLE and then click file and then new file. After that a new window will appear containing a black file this will be the text editor for the python

To Start with The Game
This script will gain access to the code in another module called 'random'. We will use this module to make the word random

  1. import random

Making the random choice of words

  1. print('**************Guess The Programming Language Game**************\n') #title of the game
  3. Plangs = ("python", "php", "javascript", "c", "perl", "c++", "java", "ruby", "c#", "visual basic", "fortran") #this will be the array word for the guess game
  5. answer = random.choice(Plangs) #this will randomly pick the word from an array
  7. correct = answer #If the has been picked the word will into a new variable
  9. rumble = "" #creating a new variable

The Logic of the game

  1. while answer: #check if answer is true
  2. position = random.randrange(len(answer)) #get the range of the word
  3. rumble += answer[position] #then rumble the word of choice
  4. answer = answer[:position] + answer[(position + 1):] #rearrange the rumble words
  6. print("The Word Is:", rumble) # display the jumble word
  8. guess = input("Guess This Programming Language:") #create a input for answering the guess word
  9. guess = guess.lower() #lowercase the jumble word
  11. while (guess != correct) or (guess == ""): # check if the given answer is incorrect
  12. print("That is not the correct answer")
  13. print("\nThe Word Is:", rumble)
  14. guess = input("Guess This Programming Language:")
  15. guess = guess.lower()
  17. if guess == correct: #check if the answer is correct
  18. print("\nCongratulation You Win!")
  19. input("\n\n Press enter to exit")

There you have it we created a very simple game for Python Programming. I hope that you learn something from this tutorial. For more updates and tutorials just kindly visit this site. Enjoy Coding!!


Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.