How do I start learning Python?

I'd rather not diverge from the threads goal and indulge in idle speculation not related to learning python - trolls generally want to go off-topic, typically on Freenode's #python which is quite a nice place.

matplotlib is a Python library to graph/plot data.

I find studying other people's code to be quite useful: for example, "Flask" is a Python library/framework that allows a programmer to quickly display/process data via the web. I prefer YAML but for web-apps JSON is the norm. Not that I am an expert on Flask - I've forgotten a bit.

@app.route is a Flask python-decorator that basically maps the URL to a function - it's event driven. When the Flask framework/code receives the URL request (the '/home.html' or whatever) on port/whatever, it will call your function with data as arguments to it. In fact Flask will wrap all the HTTP Headers and such in an object for you to use within your code.
"from flask import request"

One thing I found very different from Perl/C was this:
nlp = Nlp.NLP() #basically you are calling a class in the module Nlp and instantiating/creating an object but in perl you can always tell what a var-name is because it'll be $foo for scalar - the '$' indicates scalar/single-value variables - so in python figuring out the type is quite tricky and extremely annoying! Why? Because the methods you can call on the object depend on the type - in Python you can't tell what 'word' is.. so I have to make it 'words' vs 'word' or sometimes do l_x for list_x.

Another curious thing is
> if Text is None: #in python 'None' is an object - 1 object - there is only one "None" no matter the number of times you use it, so you are not doing a numerical comparison - it's not a variable! Typically in C we do numeric comparisons (checking for NUL/NULL) which is an integer value/macro/direct integer comparison. With None we are actually checking it's physical address (pointer address - kind off) - because there's only one None object ever, you can do that.
Well you needed sample code, do you think I'll give you production ready code. You can run as many analysis on it and go on to compare with Ruby or C or anything else as you like. You can suit yourself with your assumptions.
 
Typically I use Python code to make my life easier on Linux, so I have Hexchat scripts written in Python to auto-login to IRC, alter my version/date|time, alert me when someone checks my version of client; for vim it's useful to write python scripts to auto-complete from python's stdlib/display help and such - but that didn't work too well for me. Case to point is the pastebin script which I wrote to figure out power-tools.

So non-commercial "sample code" is usually readily available if someone uses a language to solve problems in their life - which is kind of the point of programming anyhow. (alas I can't delve into anything else as it would be off topic)
 
it's a huge difference, you do it for hobbies whereas I have to do it to earn living. :p:D

Was in the hobby bandwagon when my wife delivered a Baby - all those Pi's and relative code on them is disposed off.
 
(it's completely untrue since I've never used Python for a hobby and don't know him personally - he's trolling to elicit a response - is my guess).

To improve the quality of this post, and provide something useful to readers: the python stdlib is rather dated - YAML for config files and for DB work dataset is excellent (don't learn SQL)! My suggestion is you skip reading the stdlib from Beazley and all that UnitTesting crud: re yaml itertools functools setuptools collections glob shutil hashlib subprocess are the modules to read initially. Also os.walk and sys.argv/stdin/stdout
and pip
 
Though its late, you can try visiting these videos - per Microsoft they seem to be an alternative to learn Python
- Its 44 videos and posted in 2019

On the same channel - you will see they have added few more videos for AI beginners too (don't remember the count exactly) - which also got covered by ZDNet
 
It’s important to know before you start learning your first programming language, that no matter what language you choose you’ll be learning valuable skills. So congratulation that you have chosen to make yourself skillful by embarking on this journey.

To make a better decision first you have to choose a programming language based on your goal and the second based on what language is most in-demand in the industry.

Here are Few Popular programming languages:
C++
JavaScript
Python
SQL
 
I have started with Python (again), dropped it earlier due to some reason or other. Currently referring to geeksforgeeks and this . Now while such sources are good for learning, they constrict lateral thinking and as there's no active teacher/guide, what is the best way to clarify doubts? Google ? Because for every small query one cannot make a StackExchange post so what should be a good way to ask questions, clarify doubts?
 
Whenever I start with a new language or framework I quickly go through a crash course on youtube. Since you have basic familiarity with coding this should work for you as well. A crash course will teach you how to do the most common things you need to get by, after that it's just a matter of starting to apply it on some practical application.


Travesy media is pretty good imo.

After learning the basics you can start geeksforgeeks or leetcode to gain familiarity and sense with the language.
 
Back
Top