r/learnpython • • Jul 26 '20

Post flair request

459 Upvotes

To the mods of r/learnpython,

Can we get flairs and require them on all posts? I'm thinking of things like 'Unsolved', 'Solved', 'Code Review', 'NumPy', 'Matplotlib', 'CSV', 'Pandas', 'for loops', 'while loops', 'strings', 'lists', 'data structures', 'algorithms', etc. (that is in no way a comprehensive list)

Input from the community would obviously be required before something like this should be implemented, but I think that flairs would improve the experience of this subreddit and better help people looking for help.

Let me know what y'all think.

Regards,

u/USAhj


r/learnpython • • Jan 22 '22

Today I discovered f strings and it made my day

458 Upvotes

I first learned the basics of Python about 10 years ago and really haven't done much with it since. Recently I picked it back up but instead of good old 2.7 I'm using 3.10 and today I found out about f strings. Man, what a revelation--something so simple yet so useful.

Since posts must contain a question about Python, what other nifty new things will I find in 3.10?

ETA: Wow, thanks everyone! What a wealth of information. I appreciate everyone's input.


r/learnpython • • Apr 27 '21

Do programmers save chunks of code for repeated use?

457 Upvotes

For example if I had an amazing figure template on matplotlib that I might want to use again is there a repository where you should put these things ?


r/learnpython • • Oct 15 '20

Is there a beginners python cheat sheet available anyway?

456 Upvotes

I just want something with all the main concepts and techniques laid out in one sheet of paper if possible?


r/learnpython • • Feb 05 '20

I keep failing coding interviews - best way to learn data structures and algorithms?

456 Upvotes

For context, I'm a Stats major with some programming experience. I know how to code in Python from the standpoint of knowing syntax and OOP concepts. Outside of this, I know Matplotlib, NumPy, and Pandas. I attended a few SWE intern interviews and totally bombed the coding challenges. I was asked about what type of algorithm would be most efficient for the challenge and I had to tell them I had no idea. For HackerRank challenges, I am able to code the solution, but it is nowhere near efficient. If anyone has any Python related DS&A resources which I could use to learn this topic well and that could subsequently help me in these interviews I would really appreciate it!


r/learnpython • • Mar 27 '20

People often say "Do some projects and you will improve your coding".But how do I improve my problem solving abilities?

455 Upvotes

r/learnpython • • Mar 31 '20

I have finally become "decent" at python programming!

453 Upvotes

I started learning python, after a failed aproach of learning C++.I have been learning python for about 3 months .I have learnt about OOP,closures ,decorators and a lot of other things.For the first time I feel like I am getting somewhere with programming.I started learning django but realized that to build a decent frontend I will need javascript.I am currently learning javascript and then I will start learning react.

I am not saying that I am "intermediate" programmer, I still consider myself a begginer.But I am good enough to build a project on my own and to solve a simple(6 kyu) codewars kata.

Just wanted to thank you!

also,excuse my terrible english.


r/learnpython • • Jul 30 '21

Thank you for restoring some of my hope for our species

451 Upvotes

Just wanted to thank the people that answer questions here. The fact people come here to help random internet strangers is cool. That is all. Keep being great.


r/learnpython • • Mar 17 '21

Stanford's Code in Place Course

451 Upvotes

Hey everyone,

Stanford's Code in Place course, which loosely follows their CS106A Programming Methodologies class, is being offered again starting April 19th with student applications due by April 8th. This is a great entry level Python and Programming class. I was fortunate enough to take this class last spring, and it really was a great learning experience, and best of all, it was free!

I'm not affiliated with this course in any way, other than I participated in it last go-around, and really loved it, so I wanted to get the word out. Here's a link for more information: https://codeinplace.stanford.edu/

Hope this helpful for someone!

Edit:

There seems to be some interest, and that's really exciting for me. I think the main value of this course are the instructors. They seemed to be so passionate, bright, and energetic. This class really allowed me to cultivate my love of coding, and really filled in a lot of gaps that your standard online tutorial just doesn't quite fill. (It also made me wish I studied harder in high scool so I could have attended Stanford instead of my local state university). That being said, here's an inspirational clip from the instructor, Mehran, that was well, really inspiring!

https://www.youtube.com/watch?v=nWRGPxSNnag


r/learnpython • • Jun 18 '20

Python projects for beginners

449 Upvotes

Hi! I just learned basic python syntax (watched a 4 hour long python tutorial playlist while also doing it myself), what would be some good beginner projects/ programs that i’d be able to make, and second of all, what can i learn next to become better at python?


r/learnpython • • Aug 12 '20

My First Ever Python Project(Zillow_Scraper)

448 Upvotes

Hey y’all, I just completed my first ever programming project! I recently just completed a Python course on Udemy(S/O Jose) and I wanted to build my own project from stratch. I wanted the project to be meaningful and impactful to me, and since I’m considering moving from my current apartment, I wanted to know what other apartments/homes are renting for in the city I live in(Arlington Tx). I decided to build a webscraper that grabs all the listing info for places being put up for rent on Zillows website and writes it all out to a CSV file using Pandas. Link to the github repo down below let me know what y’all think!

https://github.com/faithfulalabi/Zillow_Scraper

P.S I know there’s probably 1000 ways I could’ve written the code better but I’d love y’alls input on some of the big ones that are relevant to be becoming a great programmer.


r/learnpython • • Oct 27 '19

mind blown using help() in python

448 Upvotes

I've been programming in python for about a year now. And I've never encountered this module before, and it's soooooooo incredibly useful. Like I'll probably never even google anything ever again ( ok thats total bullshit). But really my point here is if you're learning python you should be aware of and know how to use the help module IMHO. across the thousands of webpages I've been to and resources I've used to teach myself I can't believe I didn't run into it sooner. Anyways I just thought sunday was a good day for ranting and sharing. I hadn't initially planned on asking a question here but maybe we could get something along the lines of things you found out too late and or things everyone learning python IYHO should know. :)

edit:

help is a function in python which describes the object you pass to it. The description it outputs is it's docstring, as pointed out by DataDecay more information on docstrings can be found in PEP-257

so if you want more information about an object you can pass it as an argument to help.

Say for instance you were confused as I currently am about how asyncio works.

You could type help(asyncio) and it would give you information about that package (technically object).

YAYYYYYYY and rkarl7777 both mentioned another very useful utility named dir, which will list the methods available to the object passed to it.

So after gaining a general understanding of the base package you can then look through all of its methods.

dir(asyncio)

then if you have questions about any of the methods in that list you can query those with help.

help(asyncio.StreamWriter)

Now hang on just a second while I try and find somebody who is better at explaining things than I am.

I went through a couple of articles, this one seems to be the best.

https://www.linuxnix.com/python-builtin-helpdir-help-type-and-___doc_-functions/


r/learnpython • • Aug 16 '16

Beginner's Python cheat sheets - updated

447 Upvotes

In the spring I posted a set of cheat sheets aimed at beginners, and many people found them useful. I've since completed the set of sheets, and wanted to share the full set. The additional sheets cover files and exceptions, testing, Pygame, matplotlib, Pygal, and Django.

You can download individual sheets, or download a pdf that includes all the sheets in one document. These sheets aim to remind you of Python's syntax, but they also include brief explanations of the concepts behind the syntax as well.

I wrote these sheets as supporting documentation for readers of Python Crash Course, but I think they're useful for beginners in general. I hope you find them helpful, and I'm happy to answer any questions about them.


r/learnpython • • Jun 28 '21

Am I stupid or is this stuff harder than I thought?

446 Upvotes

Hello everyone

I'm new to learning programming languages and just started with python. My question is, is it normal to not understand certain concepts at first? some concepts seem a little abstract is that normal or am I just stupid?


r/learnpython • • Oct 03 '21

Learning your IDE Debugger will change your life

443 Upvotes

Don't make that same mistake that I did. I've been coding for more than 6 months always debugging by using print functions, spending several hours trying to run the code a thousand times hoping to get it right eventually.

When I tried to use the debugger on my own it seemed too complicated, stuff for advanced users, and never really gave it a shot. But in the past week, I decided to learn how it works, and holy fucking shit I could not believe it.

You can do so much stuff with it it is incredible. Not only you're able to keep track of all variables as the code runs line by line, you can tell it to print the variables if would like, you can set conditional breakpoints, you can evaluate new things mid debugging session like a scratchpad calculator for code. In Pycharm it allows you to see dataframes with a beautiful layout with color formatting.

I wish I knew this when I was beginning. My life would be so much easier. My productivity increased so much I feel dumb for not stopping to learn the debugging tools earlier.

Please, if you don't know how to use the debugging tool, take 30min of your day to learn it. It will change your life.

I used the first half of this video to learn the Pycharm debugger: https://www.youtube.com/watch?v=k6j1NkVAsuU


r/learnpython • • May 21 '20

I just love this subreddit,Thanks to all.

443 Upvotes

Thanks everyone who helped me out in preparing for the interview went great!,I passed the first round🙂

(link to initial post : https://www.reddit.com/r/learnpython/comments/glxpe4/what_type_of_questions_can_i_expect_in_an/?utm_source=share&utm_medium=ios_app&utm_name=iossmf)

Now I was just wondering like what sort of questions can I expect on the following topics

List,Tuples,Dictionaries,Arrays,Functions etc.

I am not able to figure out what questions are to be expected on the above things,I just know their syntax and methods thats all.

Any guidance or help would be appreciated


r/learnpython • • Jan 22 '20

Finally getting over "the hump" is such a great feeling

443 Upvotes

Posting this hopefully as an encouragement for others who are struggling learning this stuff to keep going.

The hump:

That initial stage when you're first learning where everything seems either way too simple to be of any use or way over your head so that you'll never comprehend it, so you feel stuck and unable to progress any further; then after some time you start to question how you managed to make it this far in life while being this stupid. Your brain labors to wrap itself around the understanding of these patterns and concepts that you know are simple logic, yet they elude your comprehension anyway, leading to tears of frustration and self deprecation. "I guess I'll just work Helpdesk my whole life", you start to think. Hey at least it's a job. You look at others' solutions to the practice projects/problems and you think "of course, that was so obvious. I'd have figured it out if I wasn't an idiot."

Then, finally, after several weeks or months or maybe even years, for some random reason or perhaps no reason at all, something clicks in your brain you finally start to "get it".

I first started trying to even have any semblance of learning to code like 3-4 years ago. Started with the free Code Academy Python course and bounced around to a bunch of different courses and books. Lots of ragequitting, lots of being busy with the working father & husband life, lots of just procrastination quitting and gaming instead. Lots of feeling stupid for not being able to think in simple logic.

But FINALLY, after trying to study and learn on the side here and there, after starting and restarting Automate the Boring Stuff like 3-4 times, I'm getting to the point where I can actually figure out the Practice Projects at the end of the chapters without having to go look up someone else's GitHub to get a solution. Obviously I still have quite a long way to go, but I'm finally starting to get over hump. Maybe I'm not retarded after all sniff

So if you're also stuck trying to get over the hump, just keep going and keep trying. It'll click eventually. Even if it takes a while. I know that sounds oversimplified and unhelpful but that's the same advice I got and I've found it to be true.

My current plan is to (finally) complete ATBS, then go through ATBS 2nd Edition just to see what new stuff is in there, then go on to complete CS50 via edX, and then I've got an Android development course on Udemy I bought a while back that maybe I can finally start on, and then from there, I don't know. I'm open to suggestions :) I'm trying to get to the point where I can actually work as a developer and get out of Helpdesk support, and maybe develop my own Android app(s) on the side.

But anyway, tl;dr: Keep going :)

EDIT: looks like someone posted the new MIT edX course so I hope I can complete that as well: https://www.reddit.com/r/learnpython/comments/esdgks/free_mitx_course_starts_today_jan_22_2019_on_edx


r/learnpython • • Jan 02 '23

2,000 free sign ups available for the "Automate the Boring Stuff with Python" online course. (Jan 2023)

440 Upvotes

UPDATE: The signs up are all used up. (Whoa, that was fast this month.) I'll release new codes on Feb 1st. But you can still see the first 15 of the 50 videos on YouTube, and the Previews for all the videos are enabled on the course page.

If you want to learn to code, I've released 2,000 free sign ups for my course following my Automate the Boring Stuff with Python book (each has 1,000 sign ups, use the other one if one is sold out):

https:// udemy. com/course/automate/?couponCode=JAN2023FREE

https:// udemy. com/course/automate/?couponCode=JAN2023FREE2

Udemy has changed their promo code and severely limited the number of sign ups I can provide each month, so only sign up if you are reasonably certain you can eventually finish the course. The first 15 of the course's 50 videos are free on YouTube if you want to preview them.

YOU CAN ALSO WATCH THE VIDEOS WITHOUT SIGNING UP FOR THE COURSE. All of the videos on the course webpage have "preview" turned on. Scroll down to find and click "Expand All Sections" and then click the preview link. You won't have access to the forums and other materials, but you can watch the videos.

NOTE: Be sure to BUY the course for $0, and not sign up for Udemy's subscription plan. The subscription plan is free for the first seven days and then they charge you. It's selected by default. If you are on a laptop and can't click the BUY checkbox, try shrinking the browser window. Some have reported it works in mobile view.

Sometimes it takes an hour or so for the code to become active just after I create it, so if it doesn't work, go ahead and try again a while later.

Some people in India and South Africa get a "The coupon has exceeded it's maximum possible redemptions" error message. Udemy advises that you contact their support if you have difficulty applying coupon codes, so click here to go to the contact form. If you have a VPN service, try to sign up from a North American or European proxy.

I'm also working on another Udemy course that follows my recent book "Beyond the Basic Stuff with Python". So far I have the first 15 of the planned 56 videos done. You can watch them for free on YouTube.

Side note: My latest book, Python Programming Exercises Gently Explained is a set of 42 programming exercises for beginners for free or as a 99 cent ebook.

Frequently Asked Questions: (read this before posting questions)

  • This course is for beginners and assumes no previous programming experience, but the second half is useful for experienced programmers who want to learn about various third-party Python modules.

  • If you don't have time to take the course now, that's fine. Signing up gives you lifetime access so you can work on it at your own pace.

  • This Udemy course covers roughly the same content as the 1st edition book (the book has a little bit more, but all the basics are covered in the online course), which you can read for free online at https://inventwithpython.com

  • The 2nd edition of Automate the Boring Stuff with Python is free online: https://automatetheboringstuff.com/2e/

  • I do plan on updating the Udemy course for the second edition, but it'll take a while because I have other book projects I'm working on. If you sign up for this Udemy course, you'll get the updated content automatically once I finish it. It won't be a separate course.

  • It's totally fine to start on the first edition and then read the second edition later. I'll be writing a blog post to guide first edition readers to the parts of the second edition they should read.

  • I wrote a blog post to cover what's new in the second edition

  • You're not too old to learn to code. You don't need to be "good at math" to be good at coding.

  • Signing up is the first step. Actually finishing the course is the next. :) There are several ways to get/stay motivated. I suggest getting a "gym buddy" to learn with. Check out /r/ProgrammingBuddies


r/learnpython • • Jul 14 '20

Why do people use _ in for loops?

440 Upvotes

Saw this ik a video but don't understand


r/learnpython • • Apr 19 '20

It took me almost a week to solve a simple problem but I finally did it and I'm so happy.

439 Upvotes

So, I'm doing a course on Algorithms and our graded assignments wanted us to have a 3 way partition of the quicksort. I thought it would take me like an hour to solve the problem. Well, fast forward to one week later I was still on it. I used stack overflow, read solutions and nothing clicked. I was literally clueless and stuck on a specific case and ran out of ideas. Today, a new technique just clicked and I tried working on it(but I was almost sure it wouldn't work just like the things that I've tried during the entire week but I tried anyways). After some debugging, I've tested and it's finally working. I don't know why I am sharing this but I feel like I can finally solve a problem and it was so hard for me.

EDIT: I never expected to get so many upvotes, thanks a lot guys. But, I gotta be honest with yall. I tried some test cases and looks like I still got some work to do. Oh well, back to it again

EDIT2: This time I did it for real. Submitted the assignment and got marks. Never give up guys

Exact problem was:

3 way partition of quicksort where we would want to mutate the python list and return two indexes m1, m2 such that the left side of m1 have elements that are less than X and the right side of m2 have elements that are greater than X (X being the first element of the list). That's it! And the two way partition where it just returned a single index to the left of which are elements greater than or equal to X was already implemented in the starter code.

Here's an example of what it would look like:

input:

a = [5, 1, 8, 5, 3, 2, 5, 8, 3, 5, 2, 5]

After the function call, array would be similar to

[2, 1, 3, 2, 3, 5, 5, 5, 5, 5, 8, 8]

and m1, m2 will be 5, 9


r/learnpython • • Feb 28 '20

I finally wrote something useful!

439 Upvotes

Sorry, I really don’t have anyone else to gloat to. I’ve been really trying over the past year to wrap my head around python but thought I would never get it after trying a bunch of boring online courses. I recently got the book “Automate the boring stuff with python” (I’m about half way through) and it made me start thinking about things totally differently. The way the book explained why stuff didn’t work really made things click.

A couple days ago an idea popped into my head for a project that would actually be useful for me. I wanted to take an eBay page url, drop it in and have it generate a pdf to a specific folder. I’m an eBay seller so I figured it would be nice to track some items since eBay only keeps sold records for 90 days.

I wrote it out on paper, worked through some issues and after a day, I have a code that takes an eBay url you enter,has you choose a file name, generates a pdf of the page with the name entered, creates a folder on the desktop and puts the pdf in the folder. Now I’m sure it’s messy or could have been done differently but I learned so much in the process, and it works!!

I never thought I could figure anything like this out but thanks to this sub for motivating me, I’m finally seeing progress!!


r/learnpython • • Mar 25 '21

Feeling down? Having second thoughts? Here's my story. Maybe it'll inspire you.

438 Upvotes

Background: I'm a senior at a university in NJ studying Information Technology and Cybersecurity

At the beginning of February '21, I began thinking about my senior project and what it could be. I quickly realized that I wanted to create my own license plate recognition system that was lightweight and didn't require a ton of processing power. I signed the contract with the professor overseeing my progress, and in that moment, my project was set in stone. LOSERS was a GO! *For the record, LOSERS stands for "License Observation System for Examining Rogue Speeders", and yes it took far too long to come up with.

A couple days later, I created a list of functions that I wanted the system to have; recognition, database support, web application, etc. And a few days after that, I set off and started writing the code.

Jump to February 21st and my laptops' SSD corrupts. Nothing could be recovered. I lost everything. I immediately sent an email to my professor and asked him what to do. His response..."Do your best. Try to get it done".

Now, just over four weeks later, I have my first second working prototype. I can input a video and get multiple automatic database entries of {ID, image, plate number, capture date/time}.

If you have EVER thought about quitting. Or that you can't learn Python. Don't be so hard on yourself. Before starting this project, I knew enough to make Hello World appear in the command line. That's it. Now I have multiple scripts of 85-100 lines each. You. Can. Do. This. If I can create a prototype in a month while juggling 3 other courses, you can do it too.

Edit: Y'all are way too kind! Thanks everyone for the words of wisdom, well wishes, and the awards! I've said it in the comments, but here's a couple common ideas that came up.

How could you get to senior year of college and not know how to use Git/GitHub?

Unfortunately my school prioritizes knowledge over usefulness. They'll happily teach the most convoluted ways to do something with code, but will turn the other cheek when someone mentions version control or Git.

Are you new to programming? Or just Python?

I'm new to Python. Haven't touched it before starting this project. Was that a smart decision? Probably not. But I learned a heck of a lot and I can't be more happy with where I am.

Last but not least, to those of you who are just starting your programming journey or maybe you're just starting to learn Python, please feel free to DM me with any questions or issues. I'm always happy to help you debug.

Edit 4/17/21: If anyone is interested in the project, it's here.


r/learnpython • • Jul 25 '20

Where to start to learn Machine Learning?

436 Upvotes

Hello everyone. I completed the beginning course of Python and Tkinter and have done some projects as well. But now I want to learn data science and go into Machine Learning. I don't know what to learn next. So, please help me.


r/learnpython • • Mar 15 '21

6 Month Internship Journey

435 Upvotes

It's quite crazy that I'm going to share this story because I can't really believe I pulled it off, I read so many of these posts and here I am. I started learning Python in October 2020 and it sucked me in, I started creating my own projects, attended Pycascades and fell in love with the world of programming. I landed an internship with a start-up last Friday and it's still sinking in.

I got caught up in the second round of lockdowns in France during my Masters and I had been trying to learn how to program for awhile. So I decided to give it a real chance and put as much time in as I could. The first two months weren't easy at all and I wasn't sure if I'd ever get it. I resorted to personal projects and I tried out leetcode, codewars etc. My wheels were spinning but there wasn't much traction. Once I got a few basic random projects done I started to feel more comfortable. I was reading articles, doing tutorials, buidling projects, watching lectures, etc religiously. It really felt like I found my niche and the learning was rewarding. In Januay/February I had two interviews, I wanted to see where I was and realised I was off the mark still. I bombed a coding test and the other involved a take home test, the library needed failed to install, I gave it a bash with another but came short. So I got my hands on algorithms and data structures and I dove deeper into Python and decided I wanted to learn as much as I could about the nuts and bolts.

Fast forward to last week, I was nearly finished with the learning I was focused on and moved onto asyncio and FastAPI. I saw the job posting and realised I ticked all the boxes but I wasn't sure about my Python. The first interview went extremely well and the second was based on a code review of a FastAPI project. Which I had just learnt, I implemented asyncio aswell and I seriously wasn't sure if it was good enough. I tried my best to implement good practices and just create something I'd be proud of. Well after reviewing my code, I got an offer. I honestly nearly did a back flip off my chair.

I do think I got lucky and that I still have a ton of work to do. However I followed the advice of the people that did it before me, when you ask "am I ready?" You apply and you find out, well it's sage advice. I was over the moon that I made the second round, let alone landed the internship. I counted making a second round as progress, I was aiming on landing something by the end of the year. My story isn't unique or special, I think it echoes what gets shared on reddit basically everyday. There's no shortcut and all you need to do is put the time in. Eventually you'll look at problems differently, you'll break things down and see difficult problems as a enjoyable tug of wars that you methodically deconstruct and conquer.

Thank you for all the great answers all of you give everyday. I learnt a lot by reading other peoples problems. All of the advice given is great and I appreciate you guys and girls taking time to help newbies figure things out. You're a part of these journeys, stay awesome.