Day 18 of Documentating my learning journey


What I did Today

1.Built a number guessing game project.

On What I did Today
1.A user is asked to enter a number in a specified range like 1 to 10
2.The system generates a random number and tries to match with the input of the user.
3.Depending on the input the user is aked to either guess above or below until the correct answer.
4.We output a message telling the user that they guessed right within a certain number of attempts.

How the project works
1.We import random its inbuilt in python.We use it to generate a random number which we will match it aginst the users input.
2.We pass the module to a certain variable and use a method randint() inside here we specify the paramters like 1 to 10
3.We introduce a user to the game with their name we will use impliment the use of
a)input() to ask the user to enter their name and a random number.
b)formatting using f-strings for the print statement
4.We now use a while loop and specifically a while loop that never terminates until a certain cindition is met that is while true:
5.Inside the loop we use decision structures such as if-else.
6.We 1st check if what the user has entered is integer by using isdigit()
7.Else the user is asked to renter the number.
8.Otherwise if what the user has entered is a number we skip using continue and convert it to an integer and increae the counter by 1.
9.We now much the user input with the random number generated by our system which is stored in a certain variable.
10.Depending on the users input we ask them to renter the number by telling them if its too high or too low to the random number.
11.On guessing right we now print a message telling them they are correct in acertain number of attempts.

Resources I used

1.Python series by Bonaventure Ogeto
2.Github for documenting the python series journey by pushing to my public repo course python-concepts
3.Link to the guessing game on github:[(https://github.com/yfwjay/python-concepts/blob/main/week-two/Day7/guessing_game.py)]

What I’ll be doing next
I’ll prepare what ill be learning the next week.

1.I’ll create first a README.md with a summary of qeek-two content.
2.Open a pull request and merge my week-two content to main.
3.Update the python-concepts README.md file with topics I learnt.
4.Update my local repo to make sure its upto date with the one on Github.
3.Create a new branch week-three for coming week.
4.Now introduce a new concept by creating an issue with each day milestones.
5.I’ll be ticking each day milestones and linking each day commit message with the issue.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *