r/learnpython • • May 30 '20

Python cheat sheet?

372 Upvotes

I was wondering whether you guys keep a handy cheat sheet when y'all code. For example when working with a module after a long time it's obvious that we become rusty and need help with the functions and the syntax. Would be great if you guys share the links/books that you guys refer to while programming. I'm sorry if this has been asked before. Cheers!


r/learnpython • • Nov 22 '19

Has anyone here automated their entire job?

371 Upvotes

I've read horror stories of people writing a single script that caused a department of 20 people to be let go. In a more positive context, I'm on my way to automating my entire job, which seems to be the push my boss needed to allow me to transition from my current role to a junior developer (I've only been here for 2 months, and now that I've learned the business, he's letting me do this to prove my knowledge), since my job, that can take 3 days at a time, will be done in 30 minutes or so each day. I'm super excited, and I just want to keep the excitement going by asking if anyone here has automated their entire job? What tasks did you automate? How long did it take you?


r/learnpython • • May 23 '18

Python Crash Course and An Introduction To High Performance Python

371 Upvotes

Hey, I made and ran a workshop / demonstration as part of a series of events my university is running; 'High Performance Python'.

I have all of the code and presentations on Github, so I thought I'd share it with you all in case anyone finds it useful. Github Link

The workshop had two parts;

A Python crash course / refresher -

PythonRefresher

High Performance Python -

HighPerformance

Additionally, we have a tutorial for building a simple tic-tac-toe application; PythonApp

Hope this is useful to someone, it was fun to make at least. Message me if you have suggestions, or even better fork the repo and make a pull request.

[Edit: Someone gilded this - Thank you!]


r/learnpython • • Jun 27 '22

Python MOOC Helsinki is an excellent free learning tool for beginners.

370 Upvotes

Just wanted to say this resource is incredible.

It comes with

  • Class Lectures from earlier this year

  • Many beginner exercises you start with in a browser

  • Encourages you to move to a code editor and then still checks your answers via a server

  • Difficulty scales to what you were taught

  • Provides model solutions. I always suggest looking at them for cleaner and more concise code. Code that you’ll understand because they never use a method or function you haven’t learned yet in the model solution

  • Has a discord you can join

  • Very strong focus on repetition to learn how to do things

I’ve been using for a month and I love it. Wanted to suggest it for other beginners.

https://programming-22.mooc.fi


r/learnpython • • Aug 20 '20

I am finally starting to incorporate Python into my everyday workflows and its really helping keeping me motivated to learn

370 Upvotes

Im using it for a couple of different things, but learning how to manipulate pdfs has been great as I often have to combine multiple pdfs and extract tables to bring into excel. I also had a chance to use it yesterday with matplotlib and pandas to bring in some quarterly income and expense numbers for forecasting and export some tables and their related histograms to pdf for a presentation. Originally I was more interested in the data engineering portion of my job since I knew SQL really well, but now I'm also starting to get interested in the data science side of things. Ive started to explore trying to build some predictive analytics models with some datasets that i have access to and seeing if i can possibly add any value there as we dont have a data science department.


r/learnpython • • Jun 13 '19

Managed to impress my manager with Python... that sounds dirty

370 Upvotes

Had a noteworthy event at work today. I have an internship with Amazon for the summer, but it with the Data Center Operations divisions. So working with servers mostly. But I found a way to make an impression on my manager today using Python. I can't go into specific details of what we were working on (NDA and confidentiality and all) but I can talk about what I did.

We were working with a large number of assets (327 total) and part of that work involved compiling information about those assets. Well as an intern I get all the crap jobs. So I got handed that job. So for 2 days, I've been working on compiling the info in a spreadsheet. Thought I was finished but found I only had information for 319 assets. Well, we can't just 'lose' 8 assets. That kind of looks bad on a record. So my manager wanted me to go through the list of total assets and figure out what 8 we didn't have info for. I'm like 99% sure he was expecting me to go line by line in excel and do a CTRL+F to see which ones from the total list weren't on the info list. A nice little process that would likely have taken me the better part of the day to accomplish.

Instead, I pulled up python, threw together a script to build 2 lists (one for total assets, one for the information I had compiled) and then compare the lists. Anything it found in the totals list that it didn't find in the info list got dumped to a text file.

Total time: 18 minutes (I had to look up some info on the xlswriter module).

My manager literally said: "How the hell did you do that?" when I showed him the list 20 minutes after we spoke.


r/learnpython • • Oct 29 '18

Sentdex is updating his Introduction to Python series!

370 Upvotes

For those of you who don't know who I'm talking about, Sentdex is an excellent teacher of Python and various Python libraries. He mentioned he was a little unhappy with his old Python tutorial series, and so he's updating it. I think he does a phenomenal job explaining concepts and helping you get going with Python, so I hope this helps other people as well.

If you're a beginner looking to get started, I highly recommend checking out this series as he releases it. Here's the first video, Introduction to Python 3 Programming Tutorial.


r/learnpython • • Apr 11 '18

Here's a way you can become a better programmer!

368 Upvotes

How do I become a better programmer?

I see this question on reddit quite a lot. In fact, I usually see something like it every time I open up r/learnpython or r/learnprogramming. There is always someone wanting to know how to become a better programmer, what magic pill or secret incantation that others do that instantly make them a better programmer. Invariably, there is never a simple answer to their question - often the answer boils down to 'Here's a bunch of tutorials, do them until you know the syntax then work on a project that interests you.'

This often leads to some consternation on the part of the OP as they often wonder 'What project can I possibly work on if I don't know any programming?!?' Often it seems as if they tentatively accept the advice and wander off into the wilderness to see if they can find this mystical project to work on. Sometimes you even hear back from them. Well. Today I wanted to take a moment from my own project and tell you: This is the absolute best advice anyone can give you.

All the practice tutorials out there are wonderful. Most of them, with the exception of a few that are looked down on by communities as a whole, are fairly well suited to the purpose for which they were created: Teaching the syntax of a language. See, that's the thing that most new programmers don't realize. You're not learning how to program when you're doing these tutorials, you're simply learning how to speak the language. Most people learn a few words in the language of python and want to write the next big Facebook or go to work for Google. Well, let me tell you brothers and sisters, that's the equivalent of learning how to say 'Parlez vous frances?' and wanting to immediately set off to write the next big french literary masterpiece. It's technically possible, but so unlikely as to be completely improbable.

Find a project.

So...why learn all that language (syntax) from tutorials then squander them in trying to flop around doing /MORE TUTORIALS/? There comes a point where you're just learning things that don't seem very useful to you at all - but you keep plugging through them thinking 'everyone says do this tutorial, it's GOT to make me a better programmer, right? Dave? Right??' Well, let me give you an example of why it's important to move past tutorials and go on to working on a project that you find interesting. Now, no lie, this is code that I produced in August of 2017. Nothing special, nothing fantastic. In fact, it was probably copied directly from a tutorial somewhere with very little understanding on my part until I began tweaking and moving it around. Now, this level of code was where I stayed until the end of December when I started to get interested in an opensource python project (Evennia. When I started on that it was the end of Christmas break, the kids were going back to school and since I'm a disabled stay at home dad looking for a way to become a better programmer and maybe start earning a little money to bring into the house, I figured 'What the hell...I used to love playing on Muds/Mushes/Moo's back in the day, why not take this out for a spin?' That ended up plunging me headlong into a project that I felt ill-prepared for...but after the first couple of sessions of flailing around, not knowing where anything was and asking a bunch of questions on the (friendly!) irc chat the project uses, I settled down and started going through /their/ tutorials and working on implementing my own ideas.

It's been not quite four months...and this is the code I'm producing now. Granted, there's probably a /lot/ wrong with it, and I'm still nailing down how to implement unittests into my code effectively, but...it's a hell of a lot more useful code that actually /does/ something. I know that it's messy and not as good as some of the other stuff folks are doing, but in the last four months, I've learned (on my own) about Python, git, how to set up a development environment, how important standards are and why they exist. And along the way, I've been working on different things and I'll ocassionally have a little flash of deja vu. I'll go back and look at a project and realize - hey, I've done something very like this in a tutorial! These are the moments when all the seemingly pointless how-to's and automating everything with the kitchen sink tutorials start to actually pay off.

Don't forget the secret sauce.

Here's the secret that a lot of people don't think to tell you until you've been working at programming for a while: You're going to have a hard time of it. You're going to spend a whole day on one method, trying to figure out why it returns a list of tuples instead of just a straight list because something else is doing something you didn't account for. See...that is how you become a better programmer. By sucking at it. Not being satisfied with sucking at it, you google the shit out of your problem, ask on reddit, ask in IRC, post on git or stackoverflow....That's when you become better - when you have something that you're working on that is more important to you to get working than worrying about why the syntax of ','.join(string) and string.split(',') look like that. So...keep plugging along. Find something you want to work on...something that you get up thinking about in the mornings...some puzzle you really want to solve more than you want to watch that last episode of Dr. Who. Do that and you'll become a better programmer. Just be careful or the next time you're on Reddit, you'll see someone asking 'how do I be a better programmer?' and you'll invariably answer 'Do the tutorials, then find a project to work on'.

I hope this helps some of the newer folks some. The folks who are better programmers already, I only ask that you not giggle too badly at my code...I am afterall, still learning :D

Edit

I've had several people ask me how they can contribute to the project, or how to get started. I've created a channel on Freenode

I've also started some contribution guidelines here


r/learnpython • • Apr 11 '25

how do people actually learn to code? i feel dumb lol

367 Upvotes

sorry if this sounds dumb but i’ve watched so many yt tutorials, googled stuff from websites, user ChatGPT, etc. and based on what people said to make projects and learn, I did that I made 2-3 project but i still don’t really know how to code. like i get what’s happening while watching, but the moment i try to do something on my own, my brain just goes blank.

i’m trying to learn python, eventually want to get into advance stuff, but right now even writing a simple script feels overwhelming.

am i just slow or missing something basic? how did you actually start coding for real, not just watching others do it?

any advice would help. kinda feeling stuck.


r/learnpython • • Aug 12 '22

CodeAcademy isn't free whatsoever. Why does it say "learn for free?"

367 Upvotes

You get literally one lesson that teaches you how to say hello world. Why the hell is it plastered everywhere on the site and in articles that it's free? I'm sure not paying now.


r/learnpython • • Sep 28 '21

My first project: an introspective 90-year Life Calendar

367 Upvotes

This is my first 'finished' project after self-learning over several months:

https://www.timeofyourlife.io/

It’s called Time of Your Life. It generates a 90-year calendar to represent your life, and shows you all the weeks you have lived to date. You can also add ‘life events’ — important landmarks/milestones such as a graduation or the birth/death of a loved one and they will be displayed on your calendar.

It’s completely free to use, I only ask that you give me feedback — the current features are not too extensive, but I’d like to develop it according to what you’d like to see.

I hope you find it useful — if you do, I’d appreciate it if you shared it with someone!

Built with Python (Django) and some light Javascript.

Source: https://github.com/juancoquet/time-of-your-life

Happy to answer any questions about what I've learned so far.

Edit: thank you for all the feedback! I was very nervous to share my first build, but the positive response has made my evening — I really appreciate it


r/learnpython • • Oct 18 '20

I still don’t fully understand how automation works

367 Upvotes

So, I do know some of the basics of automation. I’ve watched the automation section on automate the boring stuff with python and I’m currently watching a video talking about automating with Selenium. But... There are still some things I don’t get. Like, how do you actually automate stuff like excel, word, and other applications, Do you always have to go to the terminal to run an automation program or do you have to create an application on the desktop, are there certain things I have to download, is it possible to automate someone else’s computer from your computer, etc etc.

I’m sorry if these questions seem basic to some of you but I’m genuinely confused on this


r/learnpython • • Apr 23 '19

What are the CORE skills a Python programmer should have?

367 Upvotes

Trying to build a solid sample size of stuff to learn

EDIT: What I’ve been seeing a good amount of is besides writing clean, pythonic code, learning and understanding how to use data structures is what made a good handful of people better programmers. Interesting.


r/learnpython • • Oct 09 '20

Understanding the For Loop

366 Upvotes

Hey All,

I'm having the hardest time understanding for loops in Python.

Could someone explain what is happening in this example? I see we have a variable v. I somewhat understand that "range" is built into Python. I don't understand the output.

for v in range(3, 10, 3):
    print(v)

Output:

3

6

9

I keep seeing examples online but they lose me every time. Thank you in advance.

-------------------------------------------------

*Edit Thanks to everyone who replied. My misunderstanding was not knowing what range was fully doing.

range(start, stop, step)


r/learnpython • • Jul 29 '20

Was able to find a use case today for Python at work to connect to an access database and then build a dashboard using plotly/dash

366 Upvotes

I got sent an old access database file that I couldn't access since I didn't have a database management system or access installed. Tried to use pyodbc, but was getting a driver error and couldn't couldn't connect. Didn't realize that Access actually had a database driver so I had to get IT to install the 64-bit ACE driver. Then I was able to connect to it, write a SQL query within the pyodbc connection, create a pandas dataframe from the query output, use plotly and dash to create a chart or two and spin up a quick local hosted dashboard to illustrate a quick concept and actually be able to make progress.

Yes, I could have just imported it all table by table into excel and then use powerpivot to create a sliceable dashboard for each location (which I still might do anyways depending on what the internal customer wants to do), but it was really cool actually having a use case for it and being able to show the internal customer a quick concept on what it might look like and get some further feedback on what they were looking for.

I'll admit, having to troubleshoot and research error messages and not just be able to go "oh this is too hard" and move on to something else is intimidating. Yes, there was another way I could have done it, but being able to actually put some of my Python knowledge to use at work was a huge morale boost for the learning process.


r/learnpython • • Feb 28 '21

About to start my first python job, advice?

365 Upvotes

As the title says, I’ve recently accepted a job as a machine learning developer (my first actual development job).

I am familiar and comfortable with python, testing, documentation etc and the data science stack having self taught it over the past 18 months or so and I will be spending my notice period really solidifying these skills.

However, my background is not in computer science or software engineering but in more traditional aerospace/mechanical engineering. And I have no real experience in professional software development.

I’m interested if any of you seasoned pros have any advice on how not to be “that new guy”?

Edit: thanks everyone! Got a bunch of great practical advice!


r/learnpython • • Dec 21 '20

How do you pronounce "char"?

365 Upvotes

Like the first part of "character" or the first part of "charcoal"? Need to settle an office argument. I know it doesn't come up much in python, but you are my people.

Related I suppose: Is () an empty "two - pole" (like tucson) or an empty "tupp - pole" (like tupperware)?

Edit: currently (10:05 PST; post is 19H:44M old)
"Charcoal" has 637 upvotes from 91 comments, "Character" has 455 upvotes from 99 comments.
"Tupp-pole" has 245 upvotes from 20 comments, "Two-pole" has 202 upvotes from 45 comments.

Last update, because my vote counting script broke with the pagination and I don't feel like fixing it.

Really a lot more diversity than I thought :)


r/learnpython • • Aug 14 '17

I finally understand classes thanks to this presentation.

365 Upvotes

As a newbie to coding in general and having trouble understanding classes. This helped me a bunch, I hope others can find it useful.


r/learnpython • • Jun 14 '21

Python Projects for beginners

364 Upvotes

I have learnt basics of Python and Numpy, but now i want to practice.

Can you guys tell me which project I should do to practice or where I can see other people's code so that i could understand what they are creating.

Or you can tell me the path I should go no to make myself good at Python.


r/learnpython • • Jul 26 '20

Algovis: A python library for learning, visualizing and analysing algorithms

364 Upvotes

Hi!, I've made Algovis, a python library made for visualizing and analyzing algorithms. As a beginner, I always had trouble visualizing algorithms so I made this very easy to use library to help new python users get started. It has a lot of nice features like printing the code to terminal and visualizing in reverse. Getting started is extremely easy as well, just 5 lines of code

# importing the sorting module

from algovis import sorting

import random

my_list = [i + 1 for i in range(100)]

random.shuffle(my_list)

# creating an oject of the BubbleSort class and passing the list

bs_object = sorting.BubbleSort(my_list)

#calling the visualize method

bs_object.visualize(interval=100)

Currently the library has

Sorting

  • Bubble Sort

  • Insertion Sort

  • Selection Sort

  • Merge Sort

  • Quick Sort

Searching

  • Linear Search

  • Binary Search

Github Repo: https://github.com/hotshot07/algovis

Documentation: https://algovisdocs.netlify.app

PyPI: https://pypi.org/project/algovis/

Happy Coding :)

EDIT: Well this blew up! I'm glad you all liked it and thanks for the award u/Seralyn that made my day! I'm currently messing around with the networkx library, might add some graph algorithms in near future if I get it working.

Some python resources that I really found helpful while learning python were YouTubers Corey Schafer and Dan Bader(his python tricks book is great too). Fluent Python, obviously. For writing good code for this library I used google's style guide which is amazing (https://google.github.io/styleguide/pyguide.html). Just don't read books and follow tutorials try to make something cool and nice you'll learn a lot faster. For 'personal growth' I'd recommend 'Deep Work', by Cal Newport, that is probably the only self-help book you'll ever need for that domain and it works. The best way to learn a language is to take it slow, understand what's happening, think deeply about trivial things and then move forward.

On a side note, I was having a chat with mum who's halfway across the globe atm and she told me that 26th July 2018 was the day I had a terrible accident on the tennis court (broke 3 of my 4 knee ligaments) because of which I had to leave the university tennis team and was bedridden for about 6 months (add depression, anxiety and all that stuff). On 26th July 2020, exactly 2 years after that incident I release a python library that was trending on r/learnpython. If you're struggling, things do get better. It just takes time :)


r/learnpython • • Feb 20 '20

Okay, what do you do with python ?

364 Upvotes

Are there people here who aren't professional developers making money with python? What kind of projects do you create and what problems do they solve? As a beginner, I am curious about the kind of python programs that I can create & monetize - stuff like APIs, desktop software or a web app ? Does data science or ML payoff as a self employed?


r/learnpython • • Aug 28 '19

Is there a “Khan Academy” for programming?

364 Upvotes

Disclaimer: I know Khan Academy itself has a few programming modules. But they only scratch the surface and on their own are wholly insufficient to become a proficient coder. Khan Academy is 95% math, with everything else (incl. programming) stuffed into that remaining 5%. </disclaimer>

For the past year I have used Khan Academy religiously to improve my math skills, going from almost pre-algebra all the way up up through Calculus 2. The way Khan Academy’s math modules are structured - bite-sized lessons that introduce key concepts followed by tailored practice problems, with each lesson laying the conceptual groundwork for those that follow, and all of the major topics being covered - has been amazingly productive for me. Because of that comprehensive and scaffolded structure, now I feel very confident in my university-level math skills where once I was basically mathematically illiterate. With select exceptions, Khan Academy is the only resource I’ve needed to achieve this level of success.

What I’m wondering is, is there a similar resource for computer programming? In particular I’d like to learn Python, but eventually will also be interested in Java, R, and SQL. Again given my description of Khan Academy, what I’m looking for is a one-stop-shopping programming resource with a series of bite-sized lessons, followed by relevant exercises, that cover all the major concepts and techniques required to become proficient in a particular language. Does anybody know of such?

Edit: Free like Khan Academy is of course preferred, but for the right resource, I would definitely pay.

Edit 2: I do have a tiny bit of Python experience, but not very much at all.


r/learnpython • • Mar 02 '26

Does it still make sense to learn python or any programming language in 2026

362 Upvotes

I’m sitting here looking at my mentees and for the first time in my career, I’m genuinely questioning the path I’m putting them on.

I’ve been a seasoned pythonista for years, currently at FAANG, so I’ve seen the industry go through plenty of cycles, but 2026 feels like a total break from reality.

We used to treat programming like a craft you had to sweat over, but now that the tools are doing the heavy lifting, I’m wondering if we’re just teaching people to maintain a dying language.

I want to hear from the people actually trying to break in right now. What does the market look like from your perspective? Are you finding that deep Python knowledge actually gets you a seat at the table, or are companies just looking for someone who can glue AI modules together?

I’m asking because my perspective is skewed by being on the inside for so long. I want the raw version of what it’s like to be a junior today.

Is the struggle to learn syntax and architecture still worth it when the barrier to entry seems to be vanishing and the ceiling is lowering at the same time? Tell me if I’m being a cynic or if you’re actually seeing a future where being a coder is still a distinct, valuable skill set.

If you just landed your first job or you’re currently hunting, how much of your actual day is spent thinking about logic versus just managing the output of a machine? I'm trying to figure out if I'm preparing these guys for a career or just a temporary gig before the role of "programmer" disappears entirely.


r/learnpython • • Dec 21 '21

Can I automate one of my work’s tasks using python?

362 Upvotes

Can one of my tasks at work be automated?

I’ve been given a new task at work and it is repetitive and very time consuming.

I have been given a large spreadsheet by my manager, within this spreadsheet, there are jobs. Each job has a unique job number. To get the details of these jobs, I have to copy its unique number and paste it into the url where it gives me the job’s details.

Within each job’s url I have to go a specific section and copy that information back to the excel spreadsheet.

That is it and it is very simple but takes up so much of my time. I was wondering if there is anyway I could automate this so each job’s details are filled out quicker.