Posts: 21
Threads: 6
Joined: Oct 2019
Hello, Python world!
I recently started studying Python with the book called 'Python Crash Course' by Eric Matthes.
It has been very entertaining so far without any major problem. (I'm in chapter 6 now)
When I compare my codes for exercise to the answers on his website, however,
I notice some differences. Everything works fine, btw.
For example, The answer on the website is
print("Hello " + username + ", thank you for logging in again!")
and
Mine is
print(f"Hello {username}, thank you for logging in again!")
I assume that format for using variable in print is slightly dated, although it works.
So, finally my question is,
Where do I need to go to keep myself updated with the most recent python grammar?
(Please forgive me if the expression grammar is wrong)
Thank you in advance.
Posts: 4,220
Threads: 97
Joined: Sep 2016
Either version works fine. Yours is actually the most recent way of formatting strings. This is really just a difference in the features available in the different versions of Python. If you go to the current documentation, you'll see a link to "What's new in Python 3.7." Each new version has one of those. You'll notice a drop down at the top of the page that let's you select previous versions. So you can read all of those since whatever version the book is using (it should say in the beginning), and learn all of the new features since the book was written.
Posts: 2,342
Threads: 62
Joined: Sep 2016
Your code is more modern, the author's is out of date. In fact, I'm a little surprised they didn't use the format method instead of string concatenation.
You can follow the release notes to see the latest. You can follow PEPs if you want to stay on the bleeding edge. And I personally get most of my updates from here, and some from Google Now.
Posts: 212
Threads: 25
Joined: Aug 2019
Oct-02-2019, 07:48 PM
(This post was last modified: Oct-02-2019, 07:48 PM by newbieAuggie2019.)
(Oct-02-2019, 05:31 PM)allusernametaken Wrote: Where do I need to go to keep myself updated with the most recent python grammar?
Hi!
I'm also a newbie, and maybe one of the best ways to be informed of the latest news in Python is:
https://docs.python.org/3/library/string...ule-string
but if you are a newbie like me, without a previous programming background, you'd probably find it too extense and not geared to newbies, although it can help for specific things or if you have a programming background.
I personally find it more useful to me, sites like this one, Python-forum, or another site that I find more newbie friendly than Python docs, and it's this one:
https://realpython.com/python-f-strings/
https://realpython.com/python-string-formatting/
that even not being as comprehensive and up to date as Python docs, I find it easier to understand than that one.
I hope it helps.
All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Posts: 21
Threads: 6
Joined: Oct 2019
Thank you all!
I wanted to give everyone reputation but I didn't know my account's allowed for giving only 2 a day.
Damn. Sorry newbieAuggie2019 :(
Posts: 212
Threads: 25
Joined: Aug 2019
(Oct-02-2019, 11:37 PM)allusernametaken Wrote: Thank you all!
I wanted to give everyone reputation but I didn't know my account's allowed for giving only 2 a day.
Damn. Sorry newbieAuggie2019 :(
Don't worry!
I'm not here to win points or likes. My motivation is to help if I can.
All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Posts: 6
Threads: 0
Joined: Apr 2018
Hi, I'm the author of Python Crash Course. It sounds like you're using the second edition of the book, but looking at the online resources for the first edition.
The online resources for the second edition are here: https://ehmatthes.github.io/pcc_2e/
Posts: 21
Threads: 6
Joined: Oct 2019
newbieaussie, that's awesome. so i came back and did reputation for you haha
ehmatthes, wtf? it's nice to meet you. Thank you for your book and resource.
Posts: 6
Threads: 0
Joined: Apr 2018
Nice to meet you! And you're very welcome. I keep an eye out for questions people are asking about the book. :)
Posts: 212
Threads: 25
Joined: Aug 2019
(Oct-04-2019, 02:36 AM)allusernametaken Wrote: newbieaussie, that's awesome. so i came back and did reputation for you haha  Very kind of you to come back just to give me some reputation!
A simple 'Thank you!' would have been enough for me, but I do appreciate your kindness.
All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
|