Это видео недоступно.
Сожалеем об этом.
How to build HANGMAN with Python in 10 MINUTES
HTML-код
- Опубликовано: 12 авг 2024
- This Python tutorial for beginners shows you step-by-step how to build a basic command-line program: Hangman! The game will allow for user input, and will also output a visual of the hangman alongside the word that’s being guessed.
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. We made this RUclips channel and Kite to help you be more productive: kite.com/download/?...
***************************************
SUBSCRIBE for more Python tips, tutorials, and project breakdowns! ► ruclips.net/user/KiteHQ?sub_...
JOIN our online community of people who want to level up their developer skills ►
/ 505658083720291
Follow us on Twitter ► / kitehq
***************************************
ADDITIONAL RESOURCES:
Find the code from this tutorial here: github.com/kiteco/python-yout...
6 Python Tips and Tricks YOU Should Know ►
• 6 Python Tips and Tric...
How to NAIL LeetCode Questions- Valid Parentheses ►
• HOW TO NAIL LeetCode I...
Sqlite 3 Python Tutorial in 5 minutes- Creating Database, Tables & Querying ► • Sqlite 3 Python Tutori...
***************************************
Don’t forget to subscribe :)
ruclips.net/user/KiteHQ?sub_...
STAY TUNED:
Kite ► kite.com/
Twitter ► / kitehq
RUclips ► / @kitehq
I don't think I've ever clicked to watch an ad in my entire life until now; totally worth it.
same
whaattttttttttttttttttttttttttttttttttttttttttttttttttttt this is a add
Same
Whf! what do you mean? Every video has twice ad, so whats the problem
I guess I'm the only person here who actually searched for this video lol
Me too
We are in this together.
same
Me too
Me too.
I was stuck for hours and hours trying to figure out how to replace those underscores with the user’s guess under multiple occurrences. This video saved my life.
So glad to we could save you, Vaiterius! Thanks for the love.
I'm having the same problem, what did you do?
@@littlesheep8644 2 months late, but, if you're still stuck on this, he
1: split up the individual letters of word into a separate list word_as_list using list(word)
2: used the enumerate function, which returns the index value and letter for each character of a string, as a list of tuples ex: ( for a word 'hey', [(0, 'h'), (1, 'e'), (2, 'y')] ) (he essentially dissected the word into individual letters, each stored in a list alongside their index value as a tuple (index_value, letter) )
3: iterated over the list of tuples, for each tuple using *i* for the index value and *letter* for the letter
4: appended only the index values of the guessed letters to another list, called indices
5: iterated over the indices he collected, and used the index value to jump to the position in word_as_list where the corresponding letter was guessed, and replaced the underscore in word_as_list with the guessed letter (word_as_list would look like ['_', '_', '_'] before, and look like ['_', 'e', '_'] afterwards if 'e' was hypothetically the guessed letter)
6: he used ' '.join to convert the list format of word_as_list into a string and assign the new string as word_completion (remember word_as_list was just word_completed, but chopped up)
Don't know if you've figured it out already, but hope this helps!
Me but i made mine before seeing this
Same. But I'm still not quite sure how kite did it. He's appending i to the list if the corresponding...
As a absolute beginner to programming, I made my coded a game of hangman myself to then compare it to a more optimized version.
These are the three lessons I've learned:
1. A lot of the time python has some QOL functions that save you 10 lines of code.
2. Prepare individual functions and then have code which runs a combinations of functions, which gives you a much more understandable and cleaner program.
3. This one ties into the first, really think about what you are doing and what you're planning to.
This video was very good btw!
I just started learning how to code and this video has been super helpful. My first code was a madlibs game, but I wanted to try a game that was more responsive to user input: hang man! This video is so great because it provides a solid base for the viewer to expand on. Im going to try to add 3 different difficulty levels that the user can select which will adjust the amount of guesses per word. Im sure a more experienced programmer could add a gui. Awesome vid!
print("relatable") xD
Cool video, a bit fast for a beginner, but overall very helpful.
for beginners, LMAO
@@noobnub7305 Creating hangman is a beginner coding project.
I was gonna say the same thing.
@@noobnub7305 Always gotta have egotistical programmers in these comment sections lol.
brilliant video - thanks. My kids are learning at school and this will be very good to push their thinking.
What a great code! Thanks for posting, made my life so much easier when I compared it to my code )
This is really cool, thank you man!
instantly subscribed to your channel.
This is lightspeed compared to the other tutorials I watched and I love it
Amazing tutorial, thanks for the ad!
Great Vid. I used some techniques I learned, in my own vid! Great for a beginner
This was 10 mins for you. We made it in 1 hour after thinking about what you have done and why it has done and all. But afterall this whole video was so helpful...☺️, so thanks buddy...
Very good video and extremly helpful for New programmers like me who just need an example to copy. Can you guys please make more mini project videos like this. There are really not a lot of coding examples for python on youtube
Check out our Python Projects playlist and Beginner Tutorials playlist for more! Glad you enjoyed the video. ruclips.net/video/etSRnPp9H8s/видео.html
caaaaaaaaaaaaaaap. more python tutorials than there are js i believe
Wow this was fun. Totally worth it.
Am delighted to see it, thank you
that was nice, you made it look easy & speedy
This is the first video I saw of you!
This video is legit awesome!! I love this!!!!!
I see your ad in my feed lots time but i didn't click it 😅 and finally i click today
If you've scrolled down to the comments, let's play our own game of hangman...
_ _ T _ _ _ _ P _ _ _ _
e
_ _ T _ _ _ _ P _ E _ E
A
A _ T _ _ _ _ P _ E _ E
AUTOCOMPLETE
Does this take into account words that have the same letter more than once? For example "Cheese"? It checks to see whether the guessed letter is in the hidden word but does it check to see if it appears more than once? Thank you
how do you draw the hangman's gallow thingy
i.e. the stick on the left side and his body
i searched it and absolutely loved it
Like this video? Join the Kite Developer Community on Facebook for access to more resources + support from fellow Python developers. Time to level up! facebook.com/groups/505658083720291
how can you do word_as_list=list(word_completion) if word_completion is not introduced until later in the loop?
nice tutorial, I tried your advice out for hangman python but for some reason there is a "invalid syntax error" and I did it step by step is their anyway you can look at it and help me fix it?
awesome video, im using a .txt file for the game to choose a random word but when its counting the characters of the word its counting one at the end of the word even though there is no space or additional character?? anyone else had this issue?
You are so fast that i dont even want to do it anymore :D It was like trying to catch a bus.
This was quick af, I think I am gonna have to keep searching.
omg!! this works thanks for this video bro.
I really like your videos! thank you !
Glad you enjoy them. Thank you!
Whats ur snap
Thanks! A beginner here and I didn't understand everything but thanks!
I got error; Unable to import 'words' pylint(import-error) [2, 1] how to solve it?
Very clean!!
code is really clear on a bigger screen awesome.
I tried to import the word list from your code using the exact same thing I cant.
this man. types. pretty fast
Can someone explain line 32 (or expand it): indicies= [i for i, letter in enumerate(word) if letter == guess]. I don't understand first "i" (i for ....)? Is for loop nested in If statement or the other way?
Is there a way to prompt a hint for each word? I made my own word list that's much shorter. 🤔
Thanks for this, so helpful.Can you make one with the appjar gui version please
Hey, I'm having trouble with lining up my code. Do you have any tips?
are you doing the coding in python script mode or interactive mode?
thanks, you saved my life
Does this work in Jupiter notebook? Trying to import the wordlist and it’s not working. Keeps saying module not found?
thank you
I made a version of Hangman similar to this but without the visual hanging man.
In mines, there is a hint system as well
If you have a plain list of words how do you implent this ' and this , symbol on every word??
What color theme do you use in VS Code?
any help implementing *display_hangman(tries)*? i'm totally stuck thanks in advance
Does this work for the android app called Pydroid 3??
i keep getting line 2, in
from words import word_list whenever is try to start the game
i dont get the indices part, maybe because im new, idk, can someone pls explain me.
Hi,
Very New to python i have grabbed the follow the script but is showing the following error:
line 147, in
main()
NameError: name 'main' is not defined
I am running on a Mac OS, will this be the issue? if so is there a way to resolve? Any feedback is welcome!
Thank You,
Nick
The first part with the word list doesnt work what can i do
Please how did you create that module using vs code
"simple hangman game" [cry]
It's so hardddddddddddd(cryyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)
what does 'i for i' mean here? Really trying to figure out the indices = [ i for i, letter in enumerate(rand_word) if letter==guess] part, any explanation will be helpful! Thanks
Its because of function enumirate()
Did not understand the line word = get_word() in the while loop in the main function. The word is already got value before the while loop so no one will win by the first guess word. Am I wrong?
i made this game before watching this video and tried to compare the codes, your code is very simple,short and a bit advanced from mine but many similarlies. mine has a hint system and second player mode, where the 1st player enters a hint and word for the 2nd player to guess. in the hint sysetem you can chose to either show 1 letter if the word is less than 4 letters long, or 2 letter if the word is longer. or you can chose to get the type of the word such as verb,adj, animal...
@Gotta Go no realy i had very basic knowledge of python and basic sense for game dev. you just have to know a bit of both to be honest. mostly the logic of how games should be coded, but i didnt go too deep in that. and then i gave it a shot.
also i cant beleive im replying in 10 min for a reply on my comment that's 1 year old😂😂. i realy have to find something to do with my life lmao
@@ihebbenali2745 update?
Great video but could you help me figure out why the file is opening on Sublime Text instead of initiating the game? Thank you
I tried this code but it doesn't display anything is this working in version 3.9? I'm just new in programming tho
i didn't feel like using completed code or typing the stages of the hangman, so i turned it into Russian hangman where every time the player gets a letter wrong, a bullet will be added in the chamber. So each time they miss a letter, the probability of them losing gets higher.
Cool!
Great video!!!!!!!!!!!!!!
This is the first time I clicked to watch an ad.
anyone got the whole source code and can paste it either here or in pastebin with words and the code for the game thank you very much
for some reason I don't understanding why it is say invalid syntax in line 1
oh wow I was playing around trying to make this myself today and I got stuck about how to replace a letter at the right index. I didn't know you could just do [index] ! I am both happy with myself for getting all the way to that point and a little annoyed i didn't know about that function
Can we have more walkthrough videos? I learn best that way. it allows me to correlate code with actions visually. PLS!!!
how did u get that dark mode theme in python?
There is one thing I don't understand. The statement len(guess) == len(word). Is it possible that as guess is made by the user would the letter be appended? I hope you respond.
Can you make it so that a user can type in a word, and the other user has to guess it
hey i tried this and it says that return stages[tries] is an unexpected indent
What is the difference between pytest and python selenium
thanks dude
hey i wanted to know if there is a way to import it to a discord bot ?
hey, can someone pls explain me what happens if I delete the last part
if __name__ == "__main__":
main()
bc i don't get it
print(“AMAZING video!”)
This was a great video! Can you go a little slower next time? Thank you. :)
love it
THIS DUDES WRITING IS GOD SPEED ALIN
for some reason I keep getting errors on this one line of code: return stages[tries]
Hello, where is the code? I went to Git hub and there are at least 20 files, and some of them about a bunch of cr*** I am not interested in. Why could you not just separate the files we need to run the app? (just the 3 files)>
What is the website u are using?
How can you make it print space " " in between the underscores shown for the word, for instance I copied the code given and it prints "________" instead of " _ _ _ _ _ _ " which is kind of hard to read so you can count the letters. Anybody got pointers?
In line 10 where you set an underscore for each letter, add a space after the underscore, inside the quotation marks.
"_ " instead of "_".
i'm having trouble playing again. when input why, the game just stops. any ideas?
What IDE are you using
by some problem its showing "No module named word "
please help!
darn i cant use kite my cpu does not support the avx instruction set :(
I am using this for a Computer Science project
Can someone explain why triple " was used instead of the usual single " for the stages list
I think triple is when you want the output to be wrapped/chunks - formatting
can you make a list of all the commands of codes in python (not the one used in this) and send the link in your video discription. also i would really appreciate it a lot!
which version of python r u using
how do you get that word list
how did you make the man on 7.14
Great!!!!!!!!
why cant i import word_list???
its seem like the package names word_list doesnt exist
Kite, how did you make your code open and you play?
Go to terminal on a mac, and type in the prompt "python (whatever you named the hangman file)" I'm not sure how to do it on windows though.
how do i get the words the txt file