DEV Community

Cover image for Write a program in python, to create a game, which return the number which is left in your mind?
Satyam Krishna
Satyam Krishna

Posted on • Updated on

Write a program in python, to create a game, which return the number which is left in your mind?

Algorithm of this Game is:

1.First think any number between the range give by the computer.
2.Take second number as same as first number from your friend.
3.Take the third number given by the computer.
4.Add all the numbers.
5.Then half the number after adding.
6.Return the number which you taken from your friend.
7.Now the some number is remaining in your mind, that number is display by the computer.

Explanation:

1.Open python or any python IDE like Pycharm, Visual studio Code etc.
2.Create a file by .py extension.
3.Then import time and random module.
4.Display some message like choose any number between 1-20 etc.
5.Assign a variable, where you store the random number which the computer give this number to the player.
6.Last you have do that divide the variable by 2, and that number is the number which is remaining in the mind of the player.

You can see the video on YouTube the link is : https://youtu.be/_fiA23AREXU

Source code of this game is on my GitHub you can check out:
https://github.com/satyam41/YouTube.git

Top comments (0)