Тёмный

Number Guessing Game | Python Example 

Portfolio Courses
Подписаться 205 тыс.
Просмотров 47 тыс.
50% 1

How to create a number guessing game in Python where the user tries to guess a number between 1-100 and is told to guess higher or lower until they guess correctly. Source code: github.com/portfoliocourses/p.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!

Опубликовано:

 

1 июл 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 45   
@PortfolioCourses
@PortfolioCourses Год назад
Check out these Python playlists too with 100+ similar videos... 🙂 Python Tutorials (concepts): ru-vid.com/group/PLA1FTfKBAEX73xlgzMb4jzjBSCGp0Rpto Python Examples (exercises): ru-vid.com/group/PLA1FTfKBAEX40W8OeycI8S5ltunvS8CWw
@soliez0xff
@soliez0xff Год назад
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
@PortfolioCourses
@PortfolioCourses Год назад
I'm glad it easily made sense for you, and you're welcome! :-)
@kyyzh12
@kyyzh12 4 месяца назад
Very understandable tutorial! I actually understood everything you said
@hem.lock._
@hem.lock._ Год назад
Thank you so much from this I understood how while loops work I've subbed
@PortfolioCourses
@PortfolioCourses Год назад
You're welcome, I'm glad this video was able to help you understand while loops, and welcome aboard! :-)
@sairaj2259
@sairaj2259 Год назад
Thanks! it really helped me understand the loops better.
@PortfolioCourses
@PortfolioCourses Год назад
You're welcome, I'm glad to hear it helped you out! :-)
@santhoshsathish5828
@santhoshsathish5828 6 месяцев назад
Thank you for this amazing video.. It really helped me out for my board practical’s ❤
@eggandmeat2506
@eggandmeat2506 Год назад
thanks i really needed this so thank you so much
@PortfolioCourses
@PortfolioCourses Год назад
You're very welcome, I'm glad that it was helpful! :-)
@Saudi-Ball
@Saudi-Ball Год назад
I want to put pictures in the questions but how??
@yivett
@yivett 8 месяцев назад
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 😬
@CoderMala
@CoderMala 3 месяца назад
Thank you so much
@Ice_2192
@Ice_2192 5 месяцев назад
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.
@tASBIDTASEENAHMED
@tASBIDTASEENAHMED Месяц назад
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
@nikola---123
@nikola---123 3 месяца назад
Thanks bro
@gedeonaziagbe6231
@gedeonaziagbe6231 Год назад
thank you
@PortfolioCourses
@PortfolioCourses Год назад
You're welcome Gédéon! :-)
@fryaldraws6294
@fryaldraws6294 4 месяца назад
Thank you, this was really helpful. But you forgot to let the user know how much guesses they have guessed...
@LoujinaLoujian
@LoujinaLoujian 3 дня назад
WHICH SITE DID YOU USE
@DeathRebel369
@DeathRebel369 11 месяцев назад
How would you loop back to the user input prompt if they type in a string instead of an integer?
@adriellyaraujo2354
@adriellyaraujo2354 8 месяцев назад
I wanna know this too, have you found the answer already?
@brightkaponda5110
@brightkaponda5110 5 месяцев назад
int(input) you can use try and catch block to catch the error .
@kristnajohanna
@kristnajohanna 5 месяцев назад
Thank you! / Sweden
@PortfolioCourses
@PortfolioCourses 5 месяцев назад
You're welcome! :-)
@helenodili2360
@helenodili2360 8 месяцев назад
How do you make the program to give the user a limited amount of guesses then prints "Game over" after he reaches the limit
@Ratamos6
@Ratamos6 7 месяцев назад
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
@TakundamusiiwaMusiiwa
@TakundamusiiwaMusiiwa Месяц назад
You are the best
@PortfolioCourses
@PortfolioCourses 27 дней назад
Thanks! :-)
@ARD105
@ARD105 Год назад
What does the ! Mean in the while loop, it doesn’t work without it, what does it do???
@PortfolioCourses
@PortfolioCourses Год назад
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. :-)
@ARD105
@ARD105 Год назад
@@PortfolioCourses that makes sense, thank you
@PortfolioCourses
@PortfolioCourses Год назад
You're welcome! :-)
@Darkdragon-dp8ud
@Darkdragon-dp8ud Год назад
mine says unexpected syntax error for the if guess < number code
@PortfolioCourses
@PortfolioCourses Год назад
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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-CcgSYrWwSpE.html
@beautywow7520
@beautywow7520 Год назад
Hi idk but it isnt printing the guess lower thing at all idk why
@PortfolioCourses
@PortfolioCourses Год назад
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? :-)
@pepedafrog2277
@pepedafrog2277 Год назад
make sure the if, elif, and else statements are inside the while loop, by indenting them
@RICHAPal-qe2ve
@RICHAPal-qe2ve 5 месяцев назад
Sorry Sir but I can't understand why it stopped at 75 and told us that you want
@trapsama892
@trapsama892 Год назад
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?
@PortfolioCourses
@PortfolioCourses Год назад
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!")
@trestonnemisz9866
@trestonnemisz9866 Год назад
What if I told you I put this on my calculator
@PortfolioCourses
@PortfolioCourses Год назад
Haha I would say that's awesome Treston! :-) I would actually like to see that.
Далее
Word Guessing Game (Like Hangman) | Python Example
15:40
Советы на всё лето 4
00:23
Просмотров 546 тыс.
Create a QUIZ GAME with Python 💯
9:29
Просмотров 195 тыс.
Building a Guessing Game | Python | Tutorial 21
13:03
Random number generator in Python
6:24
Просмотров 72 тыс.
Random Number Guessing Game - Python (Beginners)
10:49
If __name__ == "__main__" for Python Developers
8:47
Просмотров 391 тыс.
Python Word Guessing Game for Beginners
13:35
Просмотров 7 тыс.
Let's code a SNAKE GAME in python! 🐍
33:06
Просмотров 587 тыс.