Тёмный
No video :(

Text-Based Wordle in Python under 15 Minutes! 

CompSci with Dr. Victor
Подписаться 243
Просмотров 15 тыс.
50% 1

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

 

25 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 19   
@foramodedra4169
@foramodedra4169 2 года назад
Hey can you show me how we can print the same guessed word with green and yellow coloured letters instead of the ggg and yyy format?? Thanks
@CompSciwithDrVictor
@CompSciwithDrVictor 2 года назад
Hey refer to the conversation I had with a commenter below. The key is to use the colored module from termcolor and replace the printing of the clue in the processGuess function with the printColored function call.
@aguuber
@aguuber 2 года назад
hi Victor - i created a verision of this that I want to publish online.. would the next step be purchasing a domain and finding a web host? new to web development so not really sure how to publish online. thanks.
@CompSciwithDrVictor
@CompSciwithDrVictor 2 года назад
That's great! It depends on how you want to publish it. Let's say you have your code in replit.com, you can make the link available just like I did in the description at any social platform you already have a presence. If you want to place it in a website, you do need to find a web hosting service to host the website you create. The general route would be to purchase a domain name from a domain registrar (e.g., domain.com, godaddy.com), set up a web hosting service and link the domain name to the space, and create your webpages. Many of the domain registrars (including those I listed above) now also provide web hosting services so you can do it all there with some additional cost. Another route would be to use a website development service (e.g., weebly.com, wix.com) and create your webpages directly. Then if you want you can purchase a domain name through them (otherwise you'll be tied to a subdomain name of theirs). A third route which I found recently is to put your code at GitHub and build a webpage there (pages.github.com/). It's a bit more involved but you have lots of control -- though if you are new to web development you might want to start with the other 2 routes.
@dish275
@dish275 2 года назад
hey man i have been trying to code this on vs code it doesnt work #
@CompSciwithDrVictor
@CompSciwithDrVictor 2 года назад
This code should work in any IDEs including VS Code. Though I haven't used VS Code to write Python code before here are some suggestions you can try: -make sure you have Python and Python extension installed (code.visualstudio.com/docs/languages/python) -double-check you have typed the code correctly, especially don't miss the colons and parentheses (if the IDE supports syntax highlighting it would warn you about those things) You can always try using other IDEs specifically developed for Python, including PyCharm, Spyder, and of course IDLE (refer to this video I made ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-RRMCNS3DBrw.html) Good luck making it work!
@sandeepkulkarni3695
@sandeepkulkarni3695 2 года назад
How to handle duplicates
@CompSciwithDrVictor
@CompSciwithDrVictor 2 года назад
Hi! Assuming you are referring to duplicates in the words list, you can use the following code to generate a list without duplicates: my_list = ["digit", "awake", "blush", "vocal", "digit"] # digit is a duplicate my_list_no_duplicates = list(set(my_list)) this code uses the fact that Python's set doesn't allow duplicates.
@Lampyy
@Lampyy 2 года назад
what are you using to code like what should i download to get the application you are using
@CompSciwithDrVictor
@CompSciwithDrVictor 2 года назад
In the video I used replit.com/. It is an online IDE so you don't have to download anything (except a browser to access their webpage). You can also use any other IDEs that support the Python programming language. For the offline ones you do have to download them. Refer to this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-RRMCNS3DBrw.html for one of them called IDLE.
@hogalpha2944
@hogalpha2944 2 года назад
Hai doc pls reply
@nokhinsiu7210
@nokhinsiu7210 2 года назад
I typed bedes and it was chief so it broke
@CompSciwithDrVictor
@CompSciwithDrVictor 2 года назад
If the answer is "chief" and you typed "bedes" this code will create an extra yellow 'e' because you are providing an extra 'e'... may that's what you mean by "broke"? Someone mentioned in the comments earlier pointing out this issue and I explained a bit why. Feel free to refer to it for more details. In my other video using C I've added a way to address it.
@nokhinsiu7210
@nokhinsiu7210 2 года назад
Broke means it didn’t say a green there
@CompSciwithDrVictor
@CompSciwithDrVictor 2 года назад
Yes it does say green. I just ran the code and for the answer "chief" when the input was "bedes" the clue it gave was "-Y-G-", as expected: first 'e' generates the Y and the second 'e' generates the G as it is in the second last position (the 'e' in "chief"). I suggest checking if your processGuess is indeed comparing the user input "bedes" with the answer "chief".
@nodroGnotlrahC
@nodroGnotlrahC 2 года назад
If the solution is ALLOW and the guess is LOLLY, it should show that there is one L in the right place, one L in the wrong place and one L that it not in the word. I do not think your code does this.
@CompSciwithDrVictor
@CompSciwithDrVictor 2 года назад
Great observation! This version would indeed give one more clue on the extra L being in the wrong place instead of not in the word. The cause of this is that the processGuess function works from the guess's perspective and uses each of its letter to compare with the answer -- as can be verified by swapping the guess with the answer to produce the result you expect. It is possible to provide a different clue by doing a bit more checking in the function but this would be a bit more complicated. Nevertheless I encourage you explore how to do it, and my question for your is: which L would you choose to say is not in the word?
@nodroGnotlrahC
@nodroGnotlrahC 2 года назад
@@CompSciwithDrVictor The "natural" way of processing English words is from left to right, which lends itself to an algorithm that says that the 3rd L is not in the word. This is the result that my code, and that of the original Wordle, produces. I too would encourage coders to explore this, and, once they have a solution, compare it to the solutions in the task "Wordle compare" on rosettacode, and add their solution there if their language of choice is not represented.
@ahmetbekirarslanalp8291
@ahmetbekirarslanalp8291 Год назад
I need to write this kind of code too, but I don't know how to print the letters are in the right place or in the wrong place, could you help me?
Далее
Text-Based Wordle in C under 25 Minutes! (Part 1 of 2)
19:36
Every Python dev falls for this (name mangling)
14:11
Просмотров 138 тыс.
O'ZBEK VA TOJIKLAR ROSSIYADA TERAKT UYUSHTIRISHDI!
08:41
If __name__ == "__main__" for Python Developers
8:47
Просмотров 397 тыс.
Learn Python With This ONE Project!
55:04
Просмотров 1,7 млн
Python GUI Development With PySimpleGUI
15:15
Просмотров 1 млн
Code Tic Tac Toe in Python
33:28
Просмотров 8 тыс.
Program Wordle in Python!
47:10
Просмотров 8 тыс.
Tmux has forever changed the way I write code.
13:30
Просмотров 969 тыс.
Python's creator wishes this feature never existed
7:21
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Просмотров 1,6 млн