How to build HANGMAN with Python in 10 MINUTES

  Рет қаралды 460,654

Kite

Kite

Күн бұрын

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 KZfaq channel and Kite to help you be more productive: kite.com/download/?...
***************************************
SUBSCRIBE for more Python tips, tutorials, and project breakdowns! ► kzfaq.info?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 :)
kzfaq.info?sub_...
STAY TUNED:
Kite ► kite.com/
Twitter ► / kitehq
KZfaq ► / @kitehq

Пікірлер: 477
@victoriatomokocountryman6129
@victoriatomokocountryman6129 4 жыл бұрын
I don't think I've ever clicked to watch an ad in my entire life until now; totally worth it.
@unbreakable7643
@unbreakable7643 4 жыл бұрын
same
@unbreakable7643
@unbreakable7643 4 жыл бұрын
whaattttttttttttttttttttttttttttttttttttttttttttttttttttt this is a add
@underscorecheered
@underscorecheered 3 жыл бұрын
Same
@ComputerScienceTechworld
@ComputerScienceTechworld 3 жыл бұрын
Whf! what do you mean? Every video has twice ad, so whats the problem
@snowy8926
@snowy8926 4 жыл бұрын
I guess I'm the only person here who actually searched for this video lol
@zygarlio9885
@zygarlio9885 4 жыл бұрын
Me too
@tochimclaren
@tochimclaren 4 жыл бұрын
We are in this together.
@vlogginggabes3864
@vlogginggabes3864 4 жыл бұрын
same
@ashsureshkumar9150
@ashsureshkumar9150 4 жыл бұрын
Me too
@kimilao5235
@kimilao5235 4 жыл бұрын
Me too.
@DragonRazor9283
@DragonRazor9283 3 жыл бұрын
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.
@KiteHQ
@KiteHQ 3 жыл бұрын
So glad to we could save you, Vaiterius! Thanks for the love.
@littlesheep8644
@littlesheep8644 3 жыл бұрын
I'm having the same problem, what did you do?
@braddaily8688
@braddaily8688 3 жыл бұрын
@@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!
@sarahharrison5798
@sarahharrison5798 2 жыл бұрын
Me but i made mine before seeing this
@aydenshahraki1084
@aydenshahraki1084 2 жыл бұрын
Same. But I'm still not quite sure how kite did it. He's appending i to the list if the corresponding...
@wqltr1822
@wqltr1822 3 жыл бұрын
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!
@KiteHQ
@KiteHQ 4 жыл бұрын
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
@KiteHQ
@KiteHQ 4 жыл бұрын
If you've scrolled down to the comments, let's play our own game of hangman... _ _ T _ _ _ _ P _ _ _ _
@erictrautmiller1154
@erictrautmiller1154 4 жыл бұрын
e
@KiteHQ
@KiteHQ 4 жыл бұрын
_ _ T _ _ _ _ P _ E _ E
@skandersoltane2001
@skandersoltane2001 4 жыл бұрын
A
@KiteHQ
@KiteHQ 4 жыл бұрын
A _ T _ _ _ _ P _ E _ E
@devayanbhattacharjee2326
@devayanbhattacharjee2326 4 жыл бұрын
AUTOCOMPLETE
@ianpimenta9197
@ianpimenta9197 3 жыл бұрын
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!
@TatesWorldGlobal
@TatesWorldGlobal 3 жыл бұрын
print("relatable") xD
@asdfasf
@asdfasf 2 жыл бұрын
brilliant video - thanks. My kids are learning at school and this will be very good to push their thinking.
@bruinsmash8836
@bruinsmash8836 3 жыл бұрын
Cool video, a bit fast for a beginner, but overall very helpful.
@noobnub7305
@noobnub7305 3 жыл бұрын
for beginners, LMAO
@zestastic3359
@zestastic3359 2 жыл бұрын
@@noobnub7305 Creating hangman is a beginner coding project.
@friday8118
@friday8118 2 жыл бұрын
I was gonna say the same thing.
@writershard5065
@writershard5065 Жыл бұрын
@@noobnub7305 Always gotta have egotistical programmers in these comment sections lol.
@sylviasobol4815
@sylviasobol4815 3 жыл бұрын
What a great code! Thanks for posting, made my life so much easier when I compared it to my code )
@fumiya9078
@fumiya9078 Жыл бұрын
This is lightspeed compared to the other tutorials I watched and I love it
@Emmi_casei
@Emmi_casei Жыл бұрын
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...
@deotheoverlord
@deotheoverlord 4 жыл бұрын
This is really cool, thank you man! instantly subscribed to your channel.
@bern1223
@bern1223 3 жыл бұрын
Amazing tutorial, thanks for the ad!
@soumitramandal
@soumitramandal 4 жыл бұрын
Wow this was fun. Totally worth it.
@VocalsOfLocalsOfficial
@VocalsOfLocalsOfficial 4 жыл бұрын
that was nice, you made it look easy & speedy
@jaganmayeesahoo4210
@jaganmayeesahoo4210 4 жыл бұрын
Am delighted to see it, thank you
@thefactlord8820
@thefactlord8820 4 жыл бұрын
Great Vid. I used some techniques I learned, in my own vid! Great for a beginner
@abhinavsai1654
@abhinavsai1654 3 жыл бұрын
This video is legit awesome!! I love this!!!!!
@aritrapal2870
@aritrapal2870 3 жыл бұрын
i searched it and absolutely loved it
@friday8118
@friday8118 2 жыл бұрын
This was quick af, I think I am gonna have to keep searching.
@ahmetsenol6104
@ahmetsenol6104 Жыл бұрын
You are so fast that i dont even want to do it anymore :D It was like trying to catch a bus.
@henningreichenbach4945
@henningreichenbach4945 4 жыл бұрын
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
@KiteHQ
@KiteHQ 4 жыл бұрын
Check out our Python Projects playlist and Beginner Tutorials playlist for more! Glad you enjoyed the video. kzfaq.info/get/bejne/m9qDhdGB1Z-saKc.html
@neodong6060
@neodong6060 2 жыл бұрын
caaaaaaaaaaaaaaap. more python tutorials than there are js i believe
@0_-
@0_- 4 жыл бұрын
This is the first video I saw of you!
@wholesomedegenerate869
@wholesomedegenerate869 3 жыл бұрын
Thanks! A beginner here and I didn't understand everything but thanks!
@AllTypeGaming6596
@AllTypeGaming6596 4 жыл бұрын
I see your ad in my feed lots time but i didn't click it 😅 and finally i click today
@tuttorosso9903
@tuttorosso9903 3 жыл бұрын
Very clean!!
@pizzamccheese9278
@pizzamccheese9278 3 жыл бұрын
how do you draw the hangman's gallow thingy i.e. the stick on the left side and his body
@Nobody-xp6ip
@Nobody-xp6ip 7 ай бұрын
I made a version of Hangman similar to this but without the visual hanging man. In mines, there is a hint system as well
@stephaniebeals5936
@stephaniebeals5936 4 жыл бұрын
how can you do word_as_list=list(word_completion) if word_completion is not introduced until later in the loop?
@alfredvonhofsten4010
@alfredvonhofsten4010 3 жыл бұрын
this man. types. pretty fast
@1979nige
@1979nige 4 жыл бұрын
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?
@Nala-Potter
@Nala-Potter 3 жыл бұрын
code is really clear on a bigger screen awesome.
@guninchoudhary4921
@guninchoudhary4921 3 жыл бұрын
omg!! this works thanks for this video bro.
@Rich171090
@Rich171090 2 жыл бұрын
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
@gyeumkim4536
@gyeumkim4536 4 жыл бұрын
I got error; Unable to import 'words' pylint(import-error) [2, 1] how to solve it?
@JustinInBlack
@JustinInBlack 2 жыл бұрын
thanks, you saved my life
@james2529
@james2529 4 жыл бұрын
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
@billychan9065
@billychan9065 3 жыл бұрын
"simple hangman game" [cry]
@ounsspace2573
@ounsspace2573 3 жыл бұрын
It's so hardddddddddddd(cryyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)
@jaysonkxm3058
@jaysonkxm3058 4 жыл бұрын
I tried to import the word list from your code using the exact same thing I cant.
@mohammadamintorabi8415
@mohammadamintorabi8415 Жыл бұрын
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?
@benjamintunaru7214
@benjamintunaru7214 4 жыл бұрын
I really like your videos! thank you !
@KiteHQ
@KiteHQ 4 жыл бұрын
Glad you enjoy them. Thank you!
@ryxnzippedem5144
@ryxnzippedem5144 4 жыл бұрын
Whats ur snap
@ihebbenali2745
@ihebbenali2745 3 жыл бұрын
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...
@ihebbenali2745
@ihebbenali2745 2 жыл бұрын
@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
@natasdabsi1138
@natasdabsi1138 Жыл бұрын
@@ihebbenali2745 update?
@ntrlshorts958
@ntrlshorts958 3 жыл бұрын
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?
@Spongebob_Squarepants
@Spongebob_Squarepants 4 жыл бұрын
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.
@GabrielsEpicLifeofGoals
@GabrielsEpicLifeofGoals 3 жыл бұрын
Cool!
@maedevaezi4428
@maedevaezi4428 3 жыл бұрын
Thanks for this, so helpful.Can you make one with the appjar gui version please
@EduardoRodrigues-hl7ne
@EduardoRodrigues-hl7ne 3 ай бұрын
Great video!!!!!!!!!!!!!!
@tjw937
@tjw937 3 жыл бұрын
Is there a way to prompt a hint for each word? I made my own word list that's much shorter. 🤔
@rantinghippie6796
@rantinghippie6796 4 жыл бұрын
Does this work in Jupiter notebook? Trying to import the wordlist and it’s not working. Keeps saying module not found?
@1UPBR0
@1UPBR0 3 жыл бұрын
Hey, I'm having trouble with lining up my code. Do you have any tips?
@timothyivanov9447
@timothyivanov9447 4 жыл бұрын
THIS DUDES WRITING IS GOD SPEED ALIN
@akankshayeola3472
@akankshayeola3472 3 жыл бұрын
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
@jhintuoso8137
@jhintuoso8137 2 жыл бұрын
Its because of function enumirate()
@neucoarc
@neucoarc 2 жыл бұрын
I am a student at a python course, and as a little activity, they (my teachers) wanted us to make a hangman game. This video helped a lot! Huge thanks to you ❤❤ (Sorry for the bad english.)
@Abdullah-Alhariri
@Abdullah-Alhariri 3 жыл бұрын
thanks dude
@seenivasagans5399
@seenivasagans5399 4 жыл бұрын
thank you
@jassgupta9115
@jassgupta9115 4 жыл бұрын
are you doing the coding in python script mode or interactive mode?
@thatgamer_2397
@thatgamer_2397 3 жыл бұрын
Does this work for the android app called Pydroid 3??
@aboynamedscienerd3524
@aboynamedscienerd3524 4 жыл бұрын
This is the first time I clicked to watch an ad.
@c0ntinuous26
@c0ntinuous26 4 жыл бұрын
What color theme do you use in VS Code?
@typeshit0
@typeshit0 4 жыл бұрын
Can you make it so that a user can type in a word, and the other user has to guess it
@pranaliparikh1292
@pranaliparikh1292 2 жыл бұрын
Great video but could you help me figure out why the file is opening on Sublime Text instead of initiating the game? Thank you
@Wabuh-Wabuh
@Wabuh-Wabuh 3 жыл бұрын
Can we have more walkthrough videos? I learn best that way. it allows me to correlate code with actions visually. PLS!!!
@heyman7891
@heyman7891 3 жыл бұрын
If you have a plain list of words how do you implent this ' and this , symbol on every word??
@g.d.z_youtube
@g.d.z_youtube 3 жыл бұрын
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?
@Paapathikids
@Paapathikids 4 жыл бұрын
What is the difference between pytest and python selenium
@ainish4940
@ainish4940 3 жыл бұрын
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
@benedikt7846
@benedikt7846 3 жыл бұрын
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?
@mayedalshamsi
@mayedalshamsi 2 жыл бұрын
In line 10 where you set an underscore for each letter, add a space after the underscore, inside the quotation marks. "_ " instead of "_".
@paratiel4295
@paratiel4295 4 жыл бұрын
love it
@nicholasmillington3624
@nicholasmillington3624 3 жыл бұрын
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
@myke6972
@myke6972 2 жыл бұрын
i dont get the indices part, maybe because im new, idk, can someone pls explain me.
@nakito8398
@nakito8398 3 жыл бұрын
I tried this code but it doesn't display anything is this working in version 3.9? I'm just new in programming tho
@Tweston3ny
@Tweston3ny 2 жыл бұрын
any help implementing *display_hangman(tries)*? i'm totally stuck thanks in advance
@martonmagyar5840
@martonmagyar5840 9 ай бұрын
i keep getting line 2, in from words import word_list whenever is try to start the game
@froxy_vn1342
@froxy_vn1342 Жыл бұрын
The first part with the word list doesnt work what can i do
@aasshmangupta9553
@aasshmangupta9553 2 жыл бұрын
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!
@mrsteampunkoctopus6524
@mrsteampunkoctopus6524 3 жыл бұрын
I am using this for a Computer Science project
@utkarsh2660
@utkarsh2660 Жыл бұрын
i actually went through this video repeatedly for 3 days and after that only was able to write the code myself
@ademolaodusanya5678
@ademolaodusanya5678 Жыл бұрын
Please how did you create that module using vs code
@ilijanedelkovski3201
@ilijanedelkovski3201 3 жыл бұрын
hey i tried this and it says that return stages[tries] is an unexpected indent
@ghostmighty8729
@ghostmighty8729 4 жыл бұрын
hey i wanted to know if there is a way to import it to a discord bot ?
@caleb-fg1nl
@caleb-fg1nl 2 жыл бұрын
Can someone explain why triple " was used instead of the usual single " for the stages list
@HeadofSails
@HeadofSails Жыл бұрын
I think triple is when you want the output to be wrapped/chunks - formatting
@jetspray3
@jetspray3 Жыл бұрын
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.
@coderutkrishthpython7244
@coderutkrishthpython7244 3 жыл бұрын
by some problem its showing "No module named word " please help!
@Seth-ki9pb
@Seth-ki9pb 2 жыл бұрын
What IDE are you using
@camigaitan2131
@camigaitan2131 2 жыл бұрын
hey, can someone pls explain me what happens if I delete the last part if __name__ == "__main__": main() bc i don't get it
@raksjdsm1234
@raksjdsm1234 Жыл бұрын
for some reason I don't understanding why it is say invalid syntax in line 1
@jennifersandford9059
@jennifersandford9059 4 жыл бұрын
which version of python r u using
@meaghangallagher6020
@meaghangallagher6020 3 жыл бұрын
i'm having trouble playing again. when input why, the game just stops. any ideas?
@shafatara4177
@shafatara4177 3 жыл бұрын
print(“AMAZING video!”)
@mostaphamansoor3969
@mostaphamansoor3969 4 жыл бұрын
how do i get the words the txt file
@priyeshpatel7585
@priyeshpatel7585 4 жыл бұрын
Already built it but felt like watching the video 👍
@t-e-hexo
@t-e-hexo 3 жыл бұрын
darn i cant use kite my cpu does not support the avx instruction set :(
@maya195
@maya195 Жыл бұрын
how did u get that dark mode theme in python?
@adamsykes3792
@adamsykes3792 4 жыл бұрын
does kite work with idle
@yuvrajwalia1797
@yuvrajwalia1797 4 жыл бұрын
Great video! I tried writing the code, and I found an error on Line 102. Instead of "return stages[tries]" it should be "return stages[tries-1] since its an array with only 6 elements. So it goes 0-1-2-3-4-5, and there's no stage 6.
@KiteHQ
@KiteHQ 4 жыл бұрын
Hi ɣʋⱴraʝ Walia, thanks for exploring the code and sharing thoughtful feedback! If the stages array had just six elements, you’d be correct in using tries-1 for the index, but this array actually has seven elements (initial display + 6 after each mistake), so using tries by itself is the appropriate index value.
@mayedalshamsi
@mayedalshamsi 2 жыл бұрын
Get rekt, Yuvraj!
@JorgeRamirez01
@JorgeRamirez01 4 жыл бұрын
I don't know what to say, I see the code and I like it, I watched the video and well, I didn't learn anything, it's like copying and pasting a piece of code I found in stackoverflow, it works but, you know what I mean. Good job though, I think.
@samchandagames7602
@samchandagames7602 2 жыл бұрын
for some reason I keep getting errors on this one line of code: return stages[tries]
@kiavash_483
@kiavash_483 4 жыл бұрын
Great!!!!!!!!
@abdulaoru7576
@abdulaoru7576 3 жыл бұрын
Cool video
@davejeet7005
@davejeet7005 2 жыл бұрын
Do you have the pseudocode for this?
How To Code Hangman In Python | Tutorial For Beginners
16:26
Shaun Halverson
Рет қаралды 48 М.
6 Python Tips and Tricks YOU Should Know
8:03
Kite
Рет қаралды 131 М.
Опасность фирменной зарядки Apple
00:57
SuperCrastan
Рет қаралды 12 МЛН
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 28 МЛН
CHOCKY MILK.. 🤣 #shorts
00:20
Savage Vlogs
Рет қаралды 14 МЛН
Build AWESOME CLIs With Click in Python
25:12
ArjanCodes
Рет қаралды 30 М.
How To Create Hangman Game in Python | Python Project Ideas
19:57
Powerful Habits to make Games Quickly
35:58
Edwardivan Labarca
Рет қаралды 49
Tmux has forever changed the way I write code.
13:30
Dreams of Code
Рет қаралды 951 М.
Super Simple Python: Simple Calculator
3:52
Yujian Tang
Рет қаралды 250
Disable/Enable Browser Context Menu in a Flet Web App | Python
6:09
Henri Ndonko - TheEthicalBoy
Рет қаралды 269
How To Create Decorator Functions In Python
4:59
Taylor's Software
Рет қаралды 5 М.
Сколько реально стоит ПК Величайшего?
0:37
Запрещенный Гаджет для Авто с aliexpress 2
0:50
Тимур Сидельников
Рет қаралды 1 МЛН
Better Than Smart Phones☠️🤯 | #trollface
0:11
Not Sanu Moments
Рет қаралды 18 МЛН
Ba Travel Smart Phone Charger
0:42
Tech Official
Рет қаралды 1,2 МЛН
Частая ошибка геймеров? 😐 Dareu A710X
1:00
Вэйми
Рет қаралды 5 МЛН