I have to admit that I felt a little sceptical when someone recommended I use the argparse module when all I was looking for was if Python exposes arguments like in a list or something. But 5 minutes later, after skimming the documentation, boy, was I grateful that whoever it was that suggested argparse had done so! You’re definitely right to be introducing it this early in your Python series; it’s a great example of why your FIRST instinct when looking to solve a problem in Python should be to google for a module. As always a great video, thanks!
@DaveGrayTeachesCode Жыл бұрын
Thank you!
@ayushman1325 Жыл бұрын
Dave The Great!❤❤
@DaveGrayTeachesCode Жыл бұрын
Thank you!
@deepatterson18949 ай бұрын
For some reason I keep getting : can't open file error message, I've tried everything even copying your lesson running it directly I save it in the LESSON 15 directory. It seems when I have to use commands in the terminal is when I run into problems. One thing I notice is that you always have a $ that comes before the py but mine doesn't the $. Everything else has been great, It must be something changed with Python since you did these lessons.
@deepatterson18949 ай бұрын
Figured out what I did wrong. The folder DAVE GREY or whatever name for folder chosen to put lessons in. Example in my case I used DAVE GREY. It needs the underscore in-between first and last name DAVE_GREY. Simple thing I thought I even did this at one point but now works! Just incase anyone else has the same or similar issue.
@ahmad-murery Жыл бұрын
Thanks for the shoutout Dave! I really appreciate that. Now, we can go further and localize this game by expanding the technique used in the hello_person example, msg = { "English": { "player choice": " {name}, please enter... 1 for Rock, 2 for Paper, or 3 for Scissors: ", "choice confirm": "{name}, please enter 1, 2, or 3", }, "German": { "player choice": " {name}, bitte geben Sie ein... 1 für Stein, 2 für Papier oder 3 für Schere: ", "choice confirm": "{name}, bitte geben Sie 1, 2 oder 3 ein.", } } lang = "German" data = {"name": "Ahmad"} print(msg[lang]["player choice"].format(**data)) # or maybe use # print(msg[lang]["player choice"].format(name = 'Ahmad')) Maybe it's better to save language dictionary to a separate module per language and then import necessary one into the main game file, this will allow contributors to add more languages (and will keep the game small, clean and easier to update independently) Google translate was used for German messages, so please forgive me for any mistakes😁
@alhabib_o4 ай бұрын
Shouldn't we remove the 'required=True' from the add_argumetn( ) ? but this way we can run from anywhere not just from the terminal window..... And, why do I need to mark the name parameter as 'nonlocal' if I'm not going to modify it? Thank you so much, Dave for this amazing tutorial !!
@herway18759 ай бұрын
This is a good tutorial.
@deepatterson18949 ай бұрын
you were able to get your code to work? It's not working for me.
@johnaweiss11 ай бұрын
Does "description" refer to the entire function?
@markyuuki57365 ай бұрын
Thank you for your videos. I am recently dealing with this error: File "", line 1 py rps8.py -n "Dave" ^^^^ SyntaxError: invalid syntax Can you help me in fixing it? Thank you in advance
@utinthein7274 Жыл бұрын
Thanks you, sir.
@DaveGrayTeachesCode Жыл бұрын
You're welcome!
@dimabrinza Жыл бұрын
Thank you!
@DaveGrayTeachesCode Жыл бұрын
Welcome!
@quarkorion8 ай бұрын
My code works fine without the ".title" in line 33 and 34. Why do you include that?
@mrsengeel7 ай бұрын
to convert the first character of a word to upper case while the rest of the character will be in lower case For example: friends = "hello world" find = friends.title() print(find) #output will be "Hello World" hope this helps
@quinnjin22 ай бұрын
[Errno 2] No such file or directory ??
@quinnjin22 ай бұрын
so I tried to "CD ~/" (Mac OS) to the directory to run the file... didn't work... so then I quit out, saved everything, and just drugged this lesson folder on to the visual studio file, opened terminal typed "python3 hello_person.py" and it worked, listed "usages:" and left me with "MacBook-Pro 15 COMMAND LINE ARRGUMENTS %" and a cursor...