WSQ06 Guess my number

 

picture079
Hello user. I want to play a game.

I am thinking of a number from 1 to 100, and it is not a decimal. Guess it or Game Over!

 

 

 

 

For this WSQ06 we had to program the system to take a number from the range 1 to 100. At this case we have to use the function rand_num and make it interger with randint(1,100) . The main point at this program is to play the “warm or cold” game where you give the player the clue that his guess was higher or lower than the actual number.

This is were one uses the conditionals if and elif, so one predicts all the possible answers from the user. If guess is higher than random number then it prints that the guess is higher. And viceverse if the number is lower.

At first I had troubles printing the “You win!” screen message.
randomnum question

Then I noticed that the last “elif” has to be written as “else” since it is the last option from the conditionals. This is without the actual condition “==”. Also, there was a problem with the indent since “else” has to match the “while” position. Like this:

wsq06 win.png

I did not used a conditional if the user tries a number higher than 100. This is because the program will tell the user to try a lower number. Everything is ready to go. Now let’s play!

wsq06 win

The WSQ06 is over, but I challenge myself to learn how to tell the user’s tries and to limit the game to an actual number of tries. This is in order to make a “Game Over” screen possible.

Today’s blog corresponds to the song “Swing Life Away” by Rise Against. No,  not Rage Against the Machine but Rise Against.  A song

swing life away

in 2004 as part of the album ‘Siren Song of the Counter Culture’. The perfect match of the acoustic guitar and the amazing lyrics is what makes this song perfect.

swing life away

 

CC BY-SA 4.0 WSQ06 Guess my number by rhcpalmarichie is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.