NotePD Loader
Ideas Post

Different ways to write up a random-generated number guessing game in python!

I realized the beauty of coding is that you have multiple ways to code up the same program!

So @Codédex issued a challenge/ assignment the other day on coding a random-generated number guessing using python. Something like the image below:

1. You generate 10 random numbers,

2. Have the users input a guess (number)

3. Check if the user gets it right or not?

So @paolo and @Codédex, what other ways do you think I could do here? Feel free to add it here!

Different ways to write up a random-generated number guessing game in python!
Preview

    1. My initial code, it was clunky, and a lot of unnecessary lines

    This is my initial way of coding it, it was clunky and had too many unnecessary lines, and it was unscalable if I need to generate hundreds of numbers instead of 10!

    Preview

    2. Then I found another solution for random generated numbers that's scalable

    I found a way to generate numbers that if in the future I need to change from 10 numbers to 100 numbers, I can easily do so. The changes are in line 3

    Preview

    3. Sonny from Codedex's solution

    I posted this in the discord, and Sonny came up with a better and more scalable way to write it!

    Preview
Contributors (1)
Tags
solutionprogramming+3 More
0 Like.0 Comment
Comment
Branch
Repost
Like
Comment
Branch
Like
0
172794
0
0
Comments (0)

No comments.