Тёмный
No video :(

Line-by-Line Python Project Walkthrough - Wordle Clone in Terminal! 

Replit
Подписаться 35 тыс.
Просмотров 35 тыс.
50% 1

50 lines of code is all we need to create this Wordle clone. With Replit and Python this is an easy process with no installs on your local PC. In this Python tutorial we cover every line of code so you understand and can start creating your own projects.
Want more Python tutorials? Want this same tutorial in JavaScript? Anything else let us know in the comments below.
Forked version of the code: replit.com/@Ja...
Original code: replit.com/@Th...

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

 

25 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 29   
@ClarityCoders
@ClarityCoders 2 года назад
One small bug to point out in this code! We want to make sure everything is in lowercase from the NLTK library. I have fixed this in the forked Repl see line 28. word = random.choice(words_five).lower()
@FNButterStrings
@FNButterStrings Год назад
The main issue with this code is that it doesn’t have an answer to duplicate letters. So if the word is shark, and my guess is sassy, it would say the first S is green and the other two are yellow. We only want it to mark duplicate letters if the correct word actually has duplicate letters, otherwise they need to be grey.
@JasonKibbe
@JasonKibbe 2 года назад
2 requests: 1. Check the 'guess' to ensure that it is a real word (that is 'in' words_five) 2. The feedback is somewhat flawed. If the word is SUGAR and you guess SWISS, all 3 's' turn green/yellow, even though the solution only has one. That would be more challenging to fix. Thanks for providing this!!! edit: 'green/yellow'
@ClarityCoders
@ClarityCoders 2 года назад
@jason_kibbe I don't think this is the case I think it will work correctly as coded. The first S will be green the other two yellow which should be the case. Your point one is valid we could add that into the game. Tested by changing the word variable to "sugar" and guessing "swiss". It only turns green if both the index and letter are correct. Thanks so much for watching and commenting!
@nodroGnotlrahC
@nodroGnotlrahC 2 года назад
@@ClarityCoders Please visit the rosettacode page for "Wordle comparison" - I am certain you have made a rather common error in the coding.
@dachampion_9993
@dachampion_9993 2 года назад
@@ClarityCoders i coded along in a differentanguage (c++) and had the same error with sugar and swiss. Any idea why that may be? I don’t know how versed you are in cpp, but instead of using “in” like you do in Python, I used “find()”
@ClarityCoders
@ClarityCoders 2 года назад
@@dachampion_9993 ​ Can you share your code on a repl or github? I'd love to check it out.
@nilsyd5315
@nilsyd5315 2 года назад
@@ClarityCoders but the other two s shouldn't turn yellow they aren't in the word because the s is already solved
@jasonogbebor6269
@jasonogbebor6269 Год назад
line 28 is saying red on it when i did the axact thing u told me ?
@theshinygamer
@theshinygamer Год назад
I'm having some trouble with line 6 when I do "as f:" it doesn't recognize f does anyone have any advice?
@shew
@shew 2 года назад
Great video! Yet I’m still wondering how to cope with duplicate letters. For example, if the given word is PEACH and you guess APPLE, only one P should be colored yellow.
@mertyagmur1743
@mertyagmur1743 2 года назад
I haven't watched the video yet but I tried to create a wordle clone myself and to solve this issue, while comparing the user guessed word and the random word char by char, whenever there's a full match (letter exists in the word and is in the same position), or a half match (letter exists in the word) I replace it with a "0". I of course make a list out of the string and call the function with that to be able to do this. Probably not an elegant solution but it works.
@marcustc4414
@marcustc4414 2 года назад
@@mertyagmur1743 could u maybe demonstrate how to do that, im new to all of this...
@adamehab7868
@adamehab7868 5 дней назад
Hey mate, don’t know if you still need the answer, but I ended up coding my own wordle yesterday, and to fix this issue, I made 2, 26-index arrays, one for the word to guess, one for your guess. Each word is then sorted, letter by letter, into the array, where a=0, b=1, c=2… (made this using a small function that transforms to ASCII, then subtracts 97, so a=0 instead of 97…) Then, whenever you’re about to color a letter in orange, simply check that this letter’s index in the guess array doesn’t surpass the number in the word array. If it does, skip coloring it. This ensures that only the correct amount of each letter is colored in.
@joshganzon
@joshganzon 2 года назад
I'm using Visual Studio Code for this and the only problem is for the "termcolor" part saying (Import "termcolor" could not be resolved from source Pylance(reportMissingModuleSource)
@carolmaxwell118
@carolmaxwell118 Год назад
Had the same problem. If you type cmd and open in Windows. Type pip install termcolor. Restart your computer and it should work otherwise you'll have to do this process after remove and reinstall python.
@amorinha04
@amorinha04 Год назад
Great video.
@hakannurakn2051
@hakannurakn2051 2 года назад
Thats great! Thank you so much! There is a small issue... When you guess a repetative letter, it also turned yellow. Let say the wordle is "small", and your guess is "mimic" there are two yellow m... How can I fix that?
@stewiegreen
@stewiegreen 2 года назад
he's doing a simple method that doesn't really work properly. In order to fix this I had to do 2 things. I had to create a 2nd instance of the secret word as a list ['s', 'e', 'c', 'r', 'e', 't'], then I had to 'cross out' the letters ['s', 'e', '*', 'r', 'e', 't'] in that list as my program matched the letters with my guess. easy enough for the green letters, but for the yellow letters nested for loops were required so I could 'cross out' the letter in the correct index in my list.
@marcustc4414
@marcustc4414 2 года назад
@@stewiegreen is it possible if u can explain the nested for loops, and cross out part a little more, im kinda new to this...
@ase-fabiz-ger-info1917
@ase-fabiz-ger-info1917 Год назад
See my fork for a solution to mark duplicate letters correctly, based on lists of chars. Once a char is evaluated, it is removed from the list, so that it's no longer checked again. replit.com/@iintorsu/wordle-tutorial
@phjones01
@phjones01 10 месяцев назад
@@ase-fabiz-ger-info1917 checked your eval_attempt function out and it looks good to me. Thanks, I was so close to solving this, but your method works very nicely!
@vinaydebrou83
@vinaydebrou83 Год назад
thank you, very helpful
@wahed1679
@wahed1679 2 года назад
CAN SOMEOE HELP ME WITH, how can I detect and print if player inputs more or less letters then the chosen words letter.?
@ase-fabiz-ger-info1917
@ase-fabiz-ger-info1917 Год назад
You could check for len(guess) == 5 (string length is 5 characters).
Далее
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Просмотров 1,6 млн
Text-Based Wordle in Python under 15 Minutes!
21:03
Просмотров 15 тыс.
O'ZBEK VA TOJIKLAR ROSSIYADA TERAKT UYUSHTIRISHDI!
08:41
СМАЗАЛ ДВЕРЬ
00:31
Просмотров 119 тыс.
Learn Python With This ONE Project!
55:04
Просмотров 1,7 млн
i'm so tired of talking about this..
10:00
Просмотров 29 тыс.
Python 101: Learn the 5 Must-Know Concepts
20:00
Просмотров 1,1 млн
5 Useful F-String Tricks In Python
10:02
Просмотров 298 тыс.
Python Platformer Game Tutorial for Beginners
1:52:06
Просмотров 250 тыс.
5 Mini Python Projects - For Beginners
1:41:08
Просмотров 2,8 млн