Check out these Python playlists too with 100+ similar videos... 🙂 Python Tutorials (concepts): th-cam.com/play/PLA1FTfKBAEX73xlgzMb4jzjBSCGp0Rpto.html Python Examples (exercises): th-cam.com/play/PLA1FTfKBAEX40W8OeycI8S5ltunvS8CWw.html
See now this easily made sense, thank you for explaining each step in your program’s execution in such a calculated concise manner, it actually felt like i was reading from a an actual workflow i had created whereas the rubric my professor provided felt intentionally obfuscated
I did a little more and added an attempt counter. Every time I took a guess the counter goes up and at the end of the game it says how many tries it took to guess the correct number.
Idk if you found the answer for this but i did it in that way: Attempts = 0 While guess != number Attempts += 1 If (attempts > 10) print(Game over) break
I’ll be trying this out today! I have python downloaded but to do my scripts I use Visual Studio Code because I wasn’t able to get my python working with my own terminal from my MacBook. Would I write the game on Visual and guess it with IDLE or my terminal? Sorry I’m a beginner 😬
i love this informative video. pls make more. Thank u love you so much!! This have me new ideas. Please remember my name as i might come to see you soon. ttyl!!! xoxo
The source code for this video is available here, it should work: github.com/portfoliocourses/python-example-code/blob/main/number_guessing_game.py. Maybe the : is missing? Or maybe it's an indentation issue? This video covers indentation in Python: th-cam.com/video/CcgSYrWwSpE/w-d-xo.html
The ! is part of an operator !=, it means "does not equal". So if the guess "does not equal" the number then the loop will continue because the loop condition will be true. :-)
I’m not sure why that would happen. The original code for this video is here: github.com/portfoliocourses/python-example-code/blob/main/number_guessing_game.py. Do you still get the error if you try using exactly that code? :-)
You could do something like this: if (guess < 1 or guess > 100): print("Number must be between 1-100, please guess again") elif (guess < number): print("Guess higher!") elif (guess > number): print("Guess lower!") else: print("You won!")
Check out these Python playlists too with 100+ similar videos... 🙂
Python Tutorials (concepts): th-cam.com/play/PLA1FTfKBAEX73xlgzMb4jzjBSCGp0Rpto.html
Python Examples (exercises): th-cam.com/play/PLA1FTfKBAEX40W8OeycI8S5ltunvS8CWw.html
See now this easily made sense, thank you for explaining each step in your program’s execution in such a calculated concise manner, it actually felt like i was reading from a an actual workflow i had created whereas the rubric my professor provided felt intentionally obfuscated
I'm glad it easily made sense for you, and you're welcome! :-)
Very understandable tutorial! I actually understood everything you said
Thank you for this amazing video.. It really helped me out for my board practical’s ❤
Thanks! it really helped me understand the loops better.
You're welcome, I'm glad to hear it helped you out! :-)
Thank you so much from this I understood how while loops work I've subbed
You're welcome, I'm glad this video was able to help you understand while loops, and welcome aboard! :-)
Thank you, this was really helpful.
But you forgot to let the user know how much guesses they have guessed...
I want to put pictures in the questions but how??
I did a little more and added an attempt counter. Every time I took a guess the counter goes up and at the end of the game it says how many tries it took to guess the correct number.
thanks
i really needed this
so thank you so much
You're very welcome, I'm glad that it was helpful! :-)
How do you make the program to give the user a limited amount of guesses then prints "Game over" after he reaches the limit
Idk if you found the answer for this but i did it in that way:
Attempts = 0
While guess != number
Attempts += 1
If (attempts > 10)
print(Game over)
break
Sorry Sir but I can't understand why it stopped at 75 and told us that you want
I’ll be trying this out today! I have python downloaded but to do my scripts I use Visual Studio Code because I wasn’t able to get my python working with my own terminal from my MacBook. Would I write the game on Visual and guess it with IDLE or my terminal? Sorry I’m a beginner 😬
i love this informative video. pls make more. Thank u love you so much!! This have me new ideas. Please remember my name as i might come to see you soon. ttyl!!! xoxo
Thank you so much
WHICH SITE DID YOU USE
What if I told you I put this on my calculator
Haha I would say that's awesome Treston! :-) I would actually like to see that.
How would you loop back to the user input prompt if they type in a string instead of an integer?
I wanna know this too, have you found the answer already?
int(input) you can use try and catch block to catch the error .
Thank you! / Sweden
You're welcome! :-)
mine says unexpected syntax error for the if guess < number code
The source code for this video is available here, it should work: github.com/portfoliocourses/python-example-code/blob/main/number_guessing_game.py. Maybe the : is missing? Or maybe it's an indentation issue? This video covers indentation in Python: th-cam.com/video/CcgSYrWwSpE/w-d-xo.html
thanks
You are the best
Thanks! :-)
thank you
You're welcome Gédéon! :-)
What does the ! Mean in the while loop, it doesn’t work without it, what does it do???
The ! is part of an operator !=, it means "does not equal". So if the guess "does not equal" the number then the loop will continue because the loop condition will be true. :-)
@@PortfolioCourses that makes sense, thank you
You're welcome! :-)
Hi idk but it isnt printing the guess lower thing at all idk why
I’m not sure why that would happen. The original code for this video is here: github.com/portfoliocourses/python-example-code/blob/main/number_guessing_game.py. Do you still get the error if you try using exactly that code? :-)
make sure the if, elif, and else statements are inside the while loop, by indenting them
Thanks bro
How do you make it so that if the user enters a number outside of the 1-100 range it tells the user to enter a new number?
You could do something like this:
if (guess < 1 or guess > 100):
print("Number must be between 1-100, please guess again")
elif (guess < number):
print("Guess higher!")
elif (guess > number):
print("Guess lower!")
else:
print("You won!")