Number Guessing Game

 Hello Dudes! 

Hope you all are doing well ๐Ÿ˜€

 Today we gonna see a python code for " Number Guessing Game"! . In short, in this game python will choose a random number within the given range and you are required to guess the number. Don't worry, until you choose the right one it will help you with some comments ๐Ÿ˜‰.

Language : Python

IDE : Pycharm

 Code :

- "random" module is imported (with which random number can be generated within the given range).

- An user defined function named "number_guessing_game" is created 

- Two variables are created

  1) number -In this variable randomly generated number is stored

 2) guess - The number which you guess will be stored here . Initially this variable is assigned with null.

- The logic behind while loop is : until you guess the correct number it will ask you to guess.

- The logic behind if condition is : if guessed value is lower than the generated value then the comment " Your guess is too low" will be printed similarly for higher guess value. At last if you guessed the correct value then the comment" You guessed the number!" will be printed ..Ohhoooo you made it ๐Ÿ˜‚
 

 My Output:


 

Hehe thats all! You too try this code and Enjoy Coding! 

See you in the next post bubye! Love you all <3




Comments

Popular posts from this blog

Coding in Mobile Phone!

BMI Calculator using python

Qr Code Generator using python