Python beginner
from Unable_to_report@feddit.uk to python@programming.dev on 20 May 2024 17:05
https://feddit.uk/post/12154156

Good evening, everyone. I have, but one quick inquiry. What are the best resources in your opinion to learn python by yourself as a complete beginner? Thank you all

#python

threaded - newest

best_username_ever@sh.itjust.works on 20 May 2024 17:12 next collapse

Tutorial on python.org.

treadful@lemmy.zip on 21 May 2024 05:23 next collapse

The Python docs are outstanding and I would definitely recommend giving that a try before moving to something perceived as more approachable.

andioop@programming.dev on 24 May 2024 03:23 collapse
nxdefiant@startrek.website on 20 May 2024 17:12 next collapse

iPython makes experimenting in an interactive manner so easy, I use it every day.

mapto@lemmy.world on 22 May 2024 05:23 collapse

Definitely my preference. However, for someone just starting (and not used to pressing TAB or calling help() ), an empty prompt might be intimidating.

That’s why I typically suggest interactive tutorials, e.g. any of these two: www.learnpython.org/en/Hello%2C_World! futurecoder.io/course/#IntroducingTheShell

nikaro@jlai.lu on 20 May 2024 17:18 next collapse

Certainly not the best, but codecademy is decent. After that, it should be enough for you to learn more deeply from official Python documentation, actual Python code base (from OSS repositories), and specific subjects from blog articles.

But it will highly depend on what type of content you like. For example some people may prefer books over interactive courses. If this is your case, i think this one is recognized as a very good one: learnpythonthehardway.org/python3/

realbadat@programming.dev on 20 May 2024 18:13 next collapse

After you get the basics (others covered that), what I like to do when learning a new language is make a series of simple games.

Things like:

  • Guess the number (user input)
  • Hangman (more complex user input)
  • Pong (even more complex user input, graphics, hit detection, etc)
  • Space invaders (arrays, ways to increase difficulty including qty and speed)

Etc. Good luck and enjoy learning!

ericjmorey@programming.dev on 20 May 2024 18:16 next collapse

Think Python is a top quality book for learning. The latest version of Think Python by Allen B. Downey is available for free online in the form of interactive Jupyter notebooks hosted on Google Colab meaning you don’t need to set up, install, or configure anything up front to start learning to program using python. I think it’s 100% the best way for complete beginners to start.

While you’re working through Think Python, you can get real time feedback and answers here in !python@programming.dev (programming.dev/c/python) or:

They are all quite active and helpful to new learners.

When you are ready to install and run Python locally on your hardware you can refer to the Official Python Documentation. There is a section dedicated to installing and using Python

GrizzlyMitts@programming.dev on 20 May 2024 20:27 next collapse

exercism.org/tracks/python is a good one. You can get a mentor to review and ask questions to.

frazorth@feddit.uk on 22 May 2024 08:48 collapse

And also running through FutureCoder

futurecoder.io

FizzyOrange@programming.dev on 20 May 2024 21:02 next collapse

(Ignore the downvotes on this comment btw; I’ve obviously touched a nerve with Python developers.)

Depending on what you want to do I would consider learning JavaScript instead:

  • You already have a JavaScript environment in your web browser (just press ctrl-shift-J).
  • If you want to do anything web related you basically have to learn and use JavaScript .
  • The Python tooling story is a complete disaster. If you want to spend all your time fight your tools Python is for you. Especially on Windows. JavaScript (which uses NPM) is not perfect but it is significantly better.
  • It’s like 50x faster.
  • Overall JavaScript (with Typescript anyway, which you can learn later) is a better language than Python. A notable exception is Python’s support of arbitrary precision integers. Using 64-bit integers in JavaScript is a right pain. But that won’t remotely be an issue for a beginner.

There are a couple of situations I would maybe pick Python:

  • AI. For better or worse (it’s worse) the entire AI ecosystem is based around Python so you don’t really have much choice here if you want to do AI stuff.
  • Scripts to automate integration of third party services. Generally more common for projects like AWS or whatever to provide Python libraries than JavaScript ones, so it can be easier in Python.

It really depends on what kind of projects do you want to do?

eager_eagle@lemmy.world on 20 May 2024 22:43 collapse

Overall JavaScript (with Typescript anyway, which you can learn later) is a better language than Python.

🤣🤣🤣

good one

FizzyOrange@programming.dev on 21 May 2024 19:17 collapse

Yes it is good because it’s completely true. Of course this question is going to attract a lot of Python developers who haven’t used Typescript and don’t know what they’re missing so I’m not surprised by this response.

Most Python developers still don’t even use static type hints. I guess partly because the Python tooling catastrophe makes it a quite a pain to set them up.

eager_eagle@lemmy.world on 21 May 2024 20:10 collapse

I guess partly because the Python tooling catastrophe makes it a quite a pain to set them up.

Salty huh

Saying you need to set up type hinting in Python shows that you’re the one assuming it’s a hassle like TS, where you need a different runtime to have access to something the language (JS) should have provided from the start.

Everything you need is provided by typing, which is included in a Python install. Just import it and start using it.

FizzyOrange@programming.dev on 21 May 2024 20:27 collapse

Salty huh

Very. Python’s shit tooling has cost me literal weeks of my life. It’s so bad. Have you ever used Go or Rust? If not go and try them and then you will realise that it doesn’t have to be like that.

Saying you need to set up type hinting in Python shows that you’re the one assuming it’s a hassle like TS

I’m not assuming. I have done this. It is absolutely a hassle. TS isn’t exactly hassle free but it’s still better than Python.

where you need a different runtime to have access to something the language (JS) should have provided from the start.

You mean like MyPy or Pyright? At least Typescript defines the semantics of its type hints. Python only defines the syntax! You can have multiple type checkers that conflict with each other!

Everything you need is provided by typing, which is included in a Python install. Just import it and start using it.

If you do that, nothing will actually be checked. You need to explicitly run pyright in CI.

mapto@lemmy.world on 22 May 2024 05:14 collapse

If you do that, nothing will actually be checked. You need to explicitly run pyright in CI.

Are you suggesting that you prefer to do the type validation upon execution? I’d like to have the checks done beforehand, be it in the IDE during coding or in CI. This way the feedback loop is shorter.

Then, backwards compatibility is a big thing in python, unlike node. So when typehints were introduced in 3.5 with PEP 484, they had to be optional.

At least Typescript defines the semantics of its type hints. Python only defines the syntax! You can have multiple type checkers that conflict with each other!

It is a bit more complicated than that. Here’s a quote the above-mentioned PEP (3.5 was back in 2015, we’re at 3.12 now and typehints have evolved):

Note that this PEP still explicitly does NOT prevent other uses of annotations, nor does it require (or forbid) any particular processing of annotations, even when they conform to this specification. It simply enables better coordination, as PEP 333 did for web frameworks.

peps.python.org/pep-0484/

FizzyOrange@programming.dev on 22 May 2024 10:12 collapse

Are you suggesting that you prefer to do the type validation upon execution?

No. But I would like them to actually be done! If you just write some Python code and put type hints in it and don’t do anything else then those types are not checked at all. It requires some set up and a third party tool to use them properly.

It is a bit more complicated than that. Here’s a quote

That quote is exactly what I was saying. It does not require any particular processing or type hints.

Type checkers can and do differ in whether they accept a particular piece of code.

it_depends_man@lemmy.world on 20 May 2024 21:39 next collapse

I always recommend this one:

www.w3schools.com/python/default.asp

Because the topics are sorted, easy to find and bite sized.

joshcodes@programming.dev on 20 May 2024 22:14 next collapse

Highly recommended Automate the Boring Stuff. It’d a free tutorial on YouTube and you learn things like printing, using numbers, then opening files and manipulating data. It’s useful straight away.

MXX53@programming.dev on 20 May 2024 22:59 next collapse

I learned python by finding something I wanted to make, then referencing the documentation to learn things I didn’t already know.

If I had trouble with finding it in the docs or understanding, I would just YouTube it/ duckduckgo it until I found a video that made sense.

I just did that over an over again and now about 30% of my day job is writing python.

Hafler@lemm.ee on 21 May 2024 05:41 next collapse

MIT has a free class: ocw.mit.edu/…/6-0001-introduction-to-computer-sci…

anzo@programming.dev on 21 May 2024 22:42 next collapse

For me it’s all about books… From inventwithpython.com/pygame/ to runestone.academy/ns/books/…/index.html

iarigby@lemmy.world on 22 May 2024 06:58 next collapse

I would start with codecademy for a gentle intro and then move on to one of the books

ObsidianZed@lemmy.dbzer0.com on 22 May 2024 07:01 next collapse

I always like to check out freecodecamp for anything new I want to learn about.

www.freecodecamp.org/news/tag/python/

MrAlternateTape@lemm.ee on 22 May 2024 10:46 next collapse

I understand why you ask this question, but really the fastest way to learn is to decide what you want the computer to do and start looking for that.

One thing will lead to another and you’ll learn lots of things that way, while you’re immediately using it.

Tutorials and courses can work, but usually it works best if you use whatever you are learning.

So come up with an idea for a program, and start building. There will be mistakes, anger, frustration and cursing involved, but you will learn a lot.

First at the lower level, and later on you will probably start wondering how to structure it all. And then you’ll learn about that too.

My point? Just dive in, fall on your face a couple of times and you’ll learn a lot in a short time.

skribe@aussie.zone on 23 May 2024 10:24 next collapse

CS50P

thisisnotgoingwell@programming.dev on 25 May 2024 18:29 collapse

Your experience may vary but I’m a network engineer who learned Python and I think learning regex and pandas is invaluable. Depends on what you want to build though. As far as learning resources, I’ve always liked w3schools, it’s free and to the point.

For books, python 101 by Michael Driscoll is very good. I wouldn’t spend money on courses. They can be pretty demotivating and expensive.