r/learnpython • • Nov 24 '20

Beginner/Intermediate Python Programmer Finally Using Multiple Files for Project

433 Upvotes

Holy Moley! I started playing around with building a mini-project using multiple files instead of one long file. Wait, let me back up...

I just started Python about a year ago, self-taught, and have been actively building desktop apps for my company in the CMP Semiconductor field. They're efficient applications that my boss loves and have been able to make us some good $$$. But, my codes are over 10,000 lines long. And I knew there had to be a better way.

Fast forward to today where I built a main file, and put a class in another file with some basic math functions. Then in my main file I built a little GUI to solve simple math problems. (I LOVE PYSIMPLEGUI, a big shout out to u/MikeTheWatchGuy for all the work he does.) And I just imported the class into my main and called it as normal...and it works. Easy as pie. I couldn't believe it. I feel like I've just learned a super valuable piece of information that I had been missing out on. Milestone achieved.

Thanks for reading and sharing in my epiphany!


r/learnpython • • Mar 21 '17

Learning Python for Data Science: Deep learning (TensorFlow, Theano, Keras, Caffe), scikit-learn, Kaggle, big data (Spark, Hadoop MapReduce, HDFS), matplotlib, pandas, NumPy, SciPy, Python essentials, AWS, and various command lines.

433 Upvotes

Hi Reddit,

Just wanted to share a recently updated collection of Jupyter notebooks I reference while learning about and working with data.

https://github.com/donnemartin/data-science-ipython-notebooks

Topics include:

  • Python language essentials geared towards data processing

  • Python data stack

  • Machine learning

  • Deep learning

  • Big data processing with Spark, MapReduce, and AWS

  • Statistical inference

  • Business analyses (ie churn modeling)

  • Various command lines

-Donne


r/learnpython • • Jun 04 '20

My first web app! Made with Django

432 Upvotes

I've been working diligently learning python and finally have something to show for it! It felt like a long stay in tutorial purgatory with tons of failures, but I'm starting to feel like I'm emerging :)

My first app is a net worth/personal finance app called TrackerBE!

I made it public a few weeks ago, and I'm hoping to find someone that can use it for a week or so and provide some feedback. Let me know if you're interested in poking around :) You basically add financial info, and it tracks trending charts over time. I'm hoping to add enough features and tools to launch a full service in early 2021. Let me know what you think :) Thank you!

EDIT: Here's some screenshots. I'll work on getting a home page built that provides more about the app.

Investments - Mobile View

Home Page - Desktop view

Investments - Desktop view

EDIT: Also, for my fellow students of python who feel lost, just keep on trucking along. It sounds cheesy, but you truly don't fail until you quit. Eventually, piece by piece, bit by bit, things start to make sense. Personally, I feel like I had an 'Aha!' moment working on this app where my development speed started picking up and the overall app architecture just started falling into place and making sense. The most helpful resource for me so far on my journey was the edX MITx 6.00.1x Intro to CS and Python course. Keep at it! :)

EDIT2: For those interested, my django app was deployed using Heroku. I found it far easier to get off the ground running. I had some success trying Azure and DigitalOcean, but kept running into problems I couldn't solve with my current knowledge.


r/learnpython • • Jun 21 '18

The Ultimate List of Python YouTube Channels – Real Python

432 Upvotes

For those who like to learn python by video this a great "curated" list for YouTube.

The Ultimate List of Python YouTube Channels – Real Python

https://realpython.com/python-youtube-channels

My favorites so far: Al Sweigart, Corey Schafer, Sentdex and Socratica

Let me know what you like or find useful ...


r/learnpython • • Jun 15 '20

Does anyone else forget some of the core basics? Like how to open/write a file?

431 Upvotes

Hello everyone,

I've been coding for a number of months now, and I frequently forgot some of the most basic commands/uses. Granted, I easily know where to find the answers so I just look them up, but I just feel like...am I just a bad coder or is this a common problem? Sometimes I'll just forget the command to open a file, or how to call a dictionary.


r/learnpython • • Apr 06 '17

Learn algorithms and data structures (and prep for coding interviews) with interactive coding challenges in Python

431 Upvotes

Hi Reddit,

I've recently overhauled the interactive Python coding challenges repo, now with more than double the original content:

https://github.com/donnemartin/interactive-coding-challenges

Included are unit tested reference implementations of various data structures and algorithms.

Each challenge has one or more reference solutions that are:

  • Fully functional

  • Unit tested

  • Easy-to-understand

Notebooks also detail:

  • Constraints

  • Test cases

  • Algorithms

  • Big-O time and space complexities

Anki flashcards are also available. Great for use while on-the-go!

Bonus: If you're looking to learn/practice system design or object oriented exercises, check out the sister repo, The System Design Primer:

https://github.com/donnemartin/system-design-primer

Hope this helps!

-Donne


r/learnpython • • May 09 '18

I made a thing: a Twitter bot which nags at my ISP when I'm unhappy with my internet connection.

428 Upvotes

Github repository

Inspired by a post I saw on /r/ProgrammerHumor ages ago. Critique my code as I'd be very happy to optimize it and make it more legible.


r/learnpython • • Mar 10 '23

I finally did something useful

427 Upvotes

Recently I automated something at work that probably saved me 10+ hours of repetitive work. I even had a coworker remark on how quickly I finished the project. It was extremely satisfying. I just wanted to post this, as a bit of a brag maybe, but also as encouragement to anyone who is struggling with learning right now. It can be really frustrating to learn python and find use for it, but there are times when it is extremely gratifying. Don't give up!


r/learnpython • • Feb 14 '20

Made a script that will clean your mess after death

426 Upvotes

Recently, there have been a rumor; a man deletes his friend's chrome history after his friend dead.

So, I decided to make a script that will be my buddy. My buddy will clean my chrome history and private files which I added their paths before. Being a very beginner on python, more or less, I think I achieved this project. You add the directories and set the time. On every startup, you will see your date on the screen for 10 secs. When the time comes and if you haven't set extra time on the program, it will delete your browser history and the paths you added. Also you can hide this paths too using windows superhiding method.

Here is the link: https://github.com/hasanaslan7/loyalbuddy

PS: As I said I consider myself as a beginner. If you have any opinions and arrangements on my code, I would be glad to hear them. Also, I couldn't convert this to an exe file. When I did it, I will share it on the same link.


r/learnpython • • Feb 07 '20

I have a demon. I consider myself a decent Python programmer but I can't understand when or why I should use classes.

426 Upvotes

I love Python, I've done projects that have stretched me and I am proud of. I want to make professional level code that's extensible, readable, modifiable, and organized. I know classes are how most people do this, but I am stuck in function land. I can do everything I would ever want to do with functions, but I understand there must be things I am missing out on.

Can anyone here help me see what I can do with classes that might be making my strictly func based code lacking. I think I just need some concrete examples or tips. Thanks.

Edit: Just wanted to thank everybody for all their help. There are a lot of insightful replies and between the thought put into a lot of the comments as well as the different perspectives I feel much better about the subject now - and started started re-writing a module giving me trouble that was desperately in need of a class. I'm touched and inspired by so many people willing to help.


r/learnpython • • Jul 12 '20

Jupyter Notebooks!

425 Upvotes

Jupyter Notebooks are the tool that turned the tables for me learning python. I'm just here to evangelize them. You can run your code line by line and debug as you go in a comfortable web browser interface. It's an excellent tool, and it made it so much more efficient to learn. Check it out.


r/learnpython • • Sep 04 '19

Wrote my first API

425 Upvotes

I would love any feedback. The API simply returns homebrewing calculations. I know there still a lot to do. Brew Numbers API

Github Repo


r/learnpython • • Sep 11 '20

Something to lighten your learning process (Python Programmers, disagree or agree?)

424 Upvotes

hey guys, I've been thinking a lot about Python and the learning process.

It can be brutal.

Probably the most difficult thing is not having anyone around to tell you if you're doing things right or heading in the right direction (thank goodness for this subreddit though).

I wanted to provide a few pieces of encouragement for anyone struggling with the learning process:

  • Those feelings of a lack of progress, wandering, and discouragement are normal. Some of these feelings are part of the larger experience of impostor syndrome. It's ok to feel these things, just don't give in to them.

  • The best way to overcome and not give into impostor syndrome? Fixate on growth like hell. You don't have to have huge growth, just enough to keep moving forward. Was there a recursive function you understood better? An interview question you memorized? Maybe you read a few more pages in a Automate the Boring Stuff. All small, but fantastic ways to grow and overcome impostor syndrome.

  • You're heading in the right direction. Python is a great OOP language to learn-keep going. You're asking for feedback here and genuinely asking for help. Keep staying open to feedback and make small adjustments from there.

  • You'll always be "becoming" a Python programmer and there's not a point of arrival. Remember, learning Python is a long game and you'll always be learning new things. If you ever get discouraged with forgetting a function or piece of syntax, expert Python coders still use StackOverflow to solve their problems so don't feel bad :)

Feel free to ask any questions, I'm here to help.


r/learnpython • • Oct 27 '21

I've Given Up Multiple Times Trying To Code (10+ Years). I Finally Thought Of A Simple Program Which I Just Completed!

423 Upvotes

It's a simple program which asks you what and how many drink(s) you've had. Then it calculates the total milligrams (mg) and checks whether or not you've had too much caffeine as recommended by the FDA.

I'm so happy I was finally able to complete something without following along with a video or copying from a book.

def get_drinks(prompt):
    print("*************")
    print("Type 1 for Monster energy")
    print("Type 2 for coffee")
    print("Type 3 for espresso")
    print("*************")
    
    total_caffeine = 0
    name = ''
    while True:
        try:
            value = int(input(prompt))
        except ValueError:
            print("That is not a drink.  Please try again.")
            continue
        if value == 1:
            total_caffeine += 160
            name = 'Monster'
        if value == 2:
            total_caffeine += 95
            name = 'coffee'
        if value == 3:
            total_caffeine += 64
            name = 'espresso'
        return total_caffeine, name

def get_amount(prompt):
    while True:
        try:
            amt_drinks = int(input(prompt))
        except ValueError:
            print("That is not a valid input.  PLease try again")
            continue
        return amt_drinks

def main():
    fda_total = 400 # Recommended FDA daily intake of caffeine in milligrams (mg)
    total_mg = drink[0] * amt
    if amt == 1:
        print(f"You've drank {amt} {drink[1]} which is {drink[0]}mg of caffeine.")
    if amt >= 2:
        print(f"You've drank {amt} {drink[1]}s which is a total of {total_mg}mg's of caffeine.")

    if drink[0] * amt < fda_total:
        print("You're under the daily recommended intake of caffeine. Great job!")
    else:
        print("You're over the daily recommended intake of caffeine.  Please consider drinking less caffeine.")

drink = get_drinks("What drink(s) have you consumed so far? ")
amt = get_amount("How many of those drinks have you had? ")
main()

edit: Here's the updated code if anyone wants to view - https://github.com/techmatlock/caffeine-calculator

Credit: /u/carcigenicate /u/SnipahShot and everyone else.


r/learnpython • • Sep 15 '20

IT Denied My Request to Download Python Due to Security Reasons...

422 Upvotes

I used to have admin rights (data analyst) at my previous employer.

After starting my new role, as a sales analytics manager, I can’t even get python (or even a database application) installed...

Other than personal projects, any other creative ways to continue using python?

Edit: WOW! Thanks for all the feedback. I’ve addressed it to my manager and we’ve agreed to request it again after I propose a proper justification that backs up my needs to download Python. If it gets denied by IT again, my manager might go straight to the CEO but I don’t know if that’ll be necessary. Until then, I’ll have to familiarize myself with VBA again!

Suggestions to consider:

  • VM

  • Anaconda


r/learnpython • • Jan 09 '20

I wrote an application that sets your background to NASA's picture of the day!

422 Upvotes

After some research I figured out that someone already came up with this idea (Great minds think alike!), but he took slightly different approach to this, and his is more advanced I guess. I just wanted to make something for fun, so don't expect this to be even slightly as good as his. Even if I tried it wouldn't be half as good. You can find his attempt at this here.

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

Anyway mine is windows only, and you can find the code here.

Any adviced would be appreciated.

Thanks in advance!


r/learnpython • • Sep 25 '21

UPDATE: can you help me write some clever brief code on a shirt for my boyfriend?

421 Upvotes

Thank you SO much to all the people who gave me ideas to help celebrate my boyfriends new job title “software engineer”. I appreciate you so much. I decided to make two of them into sweatshirts, and matched the colors to the dark mode code editor that he uses. I just wanted to show you all because I am so excited about ordering them! It’s written in embroidery which I think will look nice. (: Here are the sweatshirts.


r/learnpython • • Jun 21 '20

What are some really intro/beginner basic project ideas I could do to learn python? (coming from a complete starter)

421 Upvotes

Hey! I recently picked up python 3.8 in quarantine (about 6-7 days ago) and I've been watching freecodecamp.org's tutorial on it (still not finished, I'm at the part about nested loops), and was wondering what are some simple yet challenging beginner python projects I could try and make to try and actively learn rather than just be stuck in tutorial purgatory.


r/learnpython • • May 03 '20

I just got my first Internship.

421 Upvotes

And I am really happy. I am still an undergraduate student near my graduation. After getting the internship it was like it didn't have anywhere people to tell my internship or people who were that happy for me. Throughout my college I thought if I am even worthy of doing anything, That whatever am I studying is there anything new I am doing or in a better way. But I have to keep pushing because I didn't have many options. My 2 years passed and it was like I was still at ground zero. But as I was near my graduation I thought I need to get my shit together so I tried learning things from the basics again but this time with all my might. I put all my efforts this time thinking I still have time to turn around things. And after I was done with courses unsure of my skills I thought of applying for internships. I applied for so many but haven't heard from most of them up till now. But one of them responded and after some interviews and tests hired me. It's a paid internship, It not might be that big, but for me, it's enough to make me believe in myself once again. I was always worried that whatever I am studying doesn't payoff, how am I going to my parents who put this much effort in this but now it feels like I am not a total loser I might stick around. Prove my worth. I just need to let this all out.


r/learnpython • • Dec 11 '16

I just wanted to say how great Automate The Boring Stuff is

421 Upvotes

I'm only on chapter 3, but I have learned a lot. I'm able to create little programs such as a calorie calculator, small adventure game, dice simulator, etc. I'm having a lot of fun and I'm really excited for the future.

When I was learning html/css/js, I thought that's what programming was. I never enjoyed it and it was hard for me to learn. Python and ATBS has sparked something inside of me that makes me feel that fuzzy feeling again. Yipee!

I just really wanted to share with someone.

edit: spelling


r/learnpython • • Jan 02 '21

By the end of this year I want a new career -- Tips!

420 Upvotes

Howdy y'all.

I'm 30 years old and for the past six years I've dedicated my life to retail. I do enjoy working but at this point I can't see how I'd be able to continue living making only $32,000 a year. Since I was a kid I was always into computers but I never really took the time to actually learn about them. Just last month I signed up for three coding classes at a local community college which are set to start in February.

I don't know exactly what career path I want to follow yet but if anyone has any general tips for me I'd appreciate it. Just anything y'all learned along the way that you wish you knew sooner.

I know there are many resources online and that I may not necessarily need to take online courses, but for me I need that extra push to get started. I've been wanting to go back to school for a while now and this is the perfect opportunity.

Thanks!


r/learnpython • • Aug 03 '21

Python Newbies(Encouragement)

418 Upvotes

Hello newbies,

I'm also a python newbie but I wanted to provide some encouragement. Don't compare your journey to others because a lot of times, we compare ourselves to those who have been coding for many years. Once you master this programming language you will look back on it and realize how hard you were on yourself. When we stress about not learning fast enough, we forget to have fun with the learning process. It should be exciting to learn something new, not stressful. Focus on what you have learned and less on what you struggle with. Trust that you will get it eventually . Right now, you know a lot more than those who don't study Python at all. Give yourself some credit and have fun with the process.


r/learnpython • • Jan 13 '21

My professor took points off for "Hard coding" Why?

418 Upvotes

I used the following code. Please excuse any spacing errors as I'm on mobile.

cname = input("Please enter the customer's name: ")

gprice = input("Please enter the unit price for the goods: ")

gnum = input("Please enter the number of goods purchased: ")

gname = input("Please enter the name of the goods: " )

tot = float(gprice) * float(gnum)

print("The customer", cname, "paid $" + str(tot), "for 5 items of", gname)

The expected output was correct. He specifically said "print hard coding"

So turns out I'm just an Idiot and typed the 5 from the example output into my code instead of calling the variable. Thanks for the help guys lol.


r/learnpython • • Dec 24 '20

Just made my first "full" program ever! It's a game where you rob people and try to avoid the Cops. Show me some tricks, easier ways to do this, or even cool add ons I could incorporate!

418 Upvotes

I'm really proud of myself. I'm sure that it isn't cool at all to anyone else - but this is 2 months of me studying Python every day for a hour.

What are some cool things I can add?

What about easier or alternative ways to do this?

import random

def Robbery():
    total = 0
    lootlist = []
    lootposs = ["Watch", "Computer","Diamond"]
    attempts = int(input("Pick a number of times"))
    counter = 0
    watch_total = 0
    computer_total = 0
    diamond_total = 0
    game = "on"
    sentence = random.randint(0,15)
    print(f"----------------------------------------------------------------------")
    print("\n----------START OF THE GAME----------\n")
    for nums in range(attempts):
        Outcome = random.randint(0, 10)
        if Outcome in [0,1,2,3,4]:
            stolen = random.randint(0,1000)
            total = total + stolen
            counter = counter + 1
            print(f"----------------------------------------------------------------------")
            print(f"\nNumber {counter} attempt was successful:")
            print(f"-------------------------------------------")
            print(f"You stole {stolen} dollars.")
            print(f"You have stolen {total} dollars so far")
            print(f"You have stolen {watch_total} watch, {computer_total} computer, and {diamond_total} diamond so far")
        elif Outcome in [5,6,7]:
            loot = random.choice(lootposs)
            if loot == "Watch":
                watch_total = watch_total + 1
            elif loot == "Computer":
                computer_total = computer_total + 1
            else:
                diamond_total = diamond_total + 1
            lootlist.append(loot)
            counter = counter + 1
            print(f"----------------------------------------------------------------------") 
            print(f"\nNumber {counter} attempt was successful:")
            print(f"-------------------------------------------")
            print(f"You stole a {loot}!")
            print(f"You have stolen {total} dollars so far!")
            print(f"You have stolen {watch_total} watch, {computer_total} computer, and {diamond_total} diamond so far!")
        else:
            counter = counter + 1
            game = "off"
            print(f"\n----------------------------------------------------------------------")
            print(f"\nNumber {counter} attempt YOU WERE CAUGHT :( \n")   
            print(f"You robbed {counter} times, stole {total} dollars!")
            print(f"You took {watch_total} watch, {computer_total} computer, and {diamond_total} diamond!")
            print(f"You went to prison for {sentence} years!")
            break
    if game == "on":
        print(f"\n----------------------------------------------------------------------")     
        print(f"\nNumber {counter} attempt YOU WERE NEVER CAUGHT!!!!! :) \n \n")
        print(f"You robbed {counter} times, stole {total} dollars")
        print(f"You took {watch_total} watch, {computer_total} computer, and {diamond_total} diamond")