Share your repls and programming experiences

← Back to all posts
Great Guessing Game!
JosiahKnisely (26)

I made this guessing game in about 20 minutes. It was my first ever Python project and I think it went pretty well! Upvote if you like it, so other people can see it.

CodeLongAndPros (123)

Great first project!

One comment though.
You use a lot of print(x, y) to concat strings, when you could use a f-string.
print(f'{x} and {y}')
It just makes your code a bit more readable.

Again, great first project!

JosiahKnisely (26)

Sorry, @CodeLongAndPros, but I don't understand. Could I just do print('f')?

CodeLongAndPros (123)

@JosiahKnisely A f-string is like a raw string, or a bytes object, in a way. You make an f-string by prefixing f to your quotes:

f'Hello World'

These work like regular strings, but with one feature:
You can embed variables and python expressions in {}

x = "Hello"
y = "World"
print(f'{x} {y}')
Hello World

These make your code more readable than raw concats, and are good practice, in my opinion.

NOTE: You HAVE to have Python 3.6 or greater to use f-strings!

JosiahKnisely (26)

Oh, I didn't know that. Thank you for enlightening me, @CodeLongAndPros!

RGameZ (0)

I like it, nicely done!

JosiahKnisely (26)

Thanks, @RGameZ. That means a lot.