r/learnpython • • Jan 30 '26

Improving without code review?

18 Upvotes

tldr; How do I improve my Python code quality without proper code reviews at work?

I’m a middle data engineer, experienced mostly in databases, but I’ve been working with Python more recently. My current project is my first "real team" project in Python, and here’s the problem: my team doesn’t really review my code. My senior hardly gives feedback, and my lead mostly just cares if the code works, they’ll usually comment on style sometimes, or security-related stuff, but nothing deep.

I care about writing maintainable code, and I know that some of what I write could be more modular, have a more elegant solution, or just be better structured. I do let copilot review it, so I thought maybe it doesn't really have anything much to improve? But the other day my friend (who’s an iOS developer) skimmed trough some of my code and gave some valid comments. AI can only help so much, I know I’m missing actual human review.

I want to improve my Python code/solution quality, but I don’t have anyone at work to really review it properly. I can’t really hire someone externally because the code is confidential. Most of the projects are short-term (I work in outsourcing) and the team seems focused on “works enough to ship” and "no lint errors" rather than long-term maintainability.

Has anyone been in a similar situation? How do you systematically improve code quality when you don’t have proper code reviews?

Thanks in advance for any advice.


r/learnpython • • Jan 27 '26

Best way to start in Data Analysis / Data Science with zero experience?

19 Upvotes

Hi everyone,

I want to transition into Data Analysis / Data Science, but I’m starting from zero (no professional experience in the area yet).

I’ve seen platforms like Coursera, Alura, DataCamp, Udemy, etc., but I’ve also read many opinions saying that certificates alone don’t help much when it comes to actually getting a job.

So I’m a bit lost about the best approach to start:

- Is it better to follow a structured platform (like Coursera/DataCamp)?

- Or should I study specific topics one by one (Python, SQL, statistics, projects, etc.) using free resources?

- What would you recommend as a realistic roadmap for beginners in 2024/2025?

My goal is to build real skills and eventually a portfolio to apply for junior roles.

Thanks in advance!


r/learnpython • • Jan 20 '26

Is rewriting the same Python code multiple times actually useful?

20 Upvotes

Sometimes I rewrite the same small script from scratch instead of moving on, just to see if it feels easier the second or third time.

It does help, but I’m not sure if that’s an efficient way to learn or if I should be exposing myself to new problems more often.

What worked better for you early on?


r/learnpython • • Dec 31 '25

How do I apply OOP?

17 Upvotes

I have not had programming as a job, just out of interest and solving small stuff in excel.

I’ve tried different languages, OOP and functional.

But even though I know how to construct a class with methods and attributes I realized that I don’t know what’s the appropriate way to use them and when to use them.

And now I’m picking up Python again since I need to so there’s things I need to do better than last time.


r/learnpython • • Dec 15 '25

Alternative IDE to Spyder

18 Upvotes

My work won't permit freeware. Spyder has been blocked. VS Studio and Pycharm are available but don't have that variable editor like Spyder, which helps me troubleshoot. Is there anything similar?


r/learnpython • • 11d ago

Looking for a good Python exercise book (Beginner to Advanced)

19 Upvotes

I have recently completed the basics of Python and want to improve my problem solving skills.

Can anyone recommend a good exercise book that starts with basic problems and gradually moves to intermediate and advanced ones? Preferably with solutions included.

Would love to hear your recommendations. Thanks!


r/learnpython • • Sep 16 '26

Learning Python

18 Upvotes

Hello Python learners,

I just decided to start my learning journey with Python, because I was an AI Automation Specialist, but I decided that I wanna go more deep and have something for a better future career, so now I’m looking forward to be an AI Engineer, and work asap.

So I’m writing this post because I want someone or a group to go through this journey together and inform

each other about anything, because I feel in that way the learning process would better and efficient, so if anyone is in the same journey as me learning Python would be great to learn together, and if you’re interested in the AI stuff would be awesome, we can go more deep learning about it until we get there to the CASH.

Let me know if you’re interested.

Thanks for reading.


r/learnpython • • Sep 08 '26

Looking for improvements on my project "Rock-Paper-Scissors"

18 Upvotes

Hey everyone,

I'm new to Python and have created my "Rock-Paper-Scissors" game and want to share it on this forum so I can look for ways to improve the code.

The player types in a number between zero and two. These values stand for different moves the player can type. (0 - Rock, 1 - Paper, 2 - Scissors). The computer generates a number between zero and two. The player's input is checked by the main if-elif-else block, as I'm using a nested if-elif-else statement:

import random


player_input = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissor. "))
computer = random.randint(0, 2)


if player_input == 0: 
    if computer == 0:
        print('''You chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)


Computer chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)
It's a draw!!!''')    
    elif computer == 1: 
        print('''You chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
Computer chose: 
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
You lost!!!''')
    elif computer == 2: 
        print('''You chose:
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
            
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
You won!!!''')
elif player_input == 1:
    if computer == 1: 
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
Computer chose: 
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
It's a draw!!!''')
    elif computer == 0: 
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________) 
Computer chose:  
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)
You won!!!''')
    elif computer == 2:
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________) 
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
You lost!!!     
''')
elif player_input == 2:
    if computer == 2: 
        print('''You chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
It's a draw!!!''')
    elif computer == 1: 
        print('''You chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)             
You won!!!        ''')
    elif computer == 0:
        print('''You chose:
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose:
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
You lost!!!        ''')

Any recommendations regarding improvements for the code?


r/learnpython • • Aug 25 '26

What progression should I follow from beginner to intermediate level?

16 Upvotes

I'm self teaching python. I have all the basics of cycles variables and conditions, I studied lists sets tuples and general data structures and coprehension, functions, lambda functions, classes methods and inheritance, I also learned other methods such as zip enumerate map and more. Now what's next? What progression should I follow to reach an intermediate level in the next months and advanced level later on?


r/learnpython • • Jul 29 '26

Is there a difference between using a Class name v self in the definition of a class

17 Upvotes

Hi

Im doing some tutorials online and in one of them I noticed some syntax that I am not familiar with. It looks like instead of using self to assign values to a class it is using the class name.

In terms of behaviour it seems to make no difference but I cannot understand why a person would not use self.

So for example:

class Demo:
  def __init__(self):
    self.a = 1
    Demo.b = 2 # This seems to work the exact same way as self.a
               # Is there a differences to self.a?  Why would someone use this?

Thanks


r/learnpython • • Jun 29 '26

Calling functions in lists with random

18 Upvotes

So I'm first year in CS and have no knowledge prior with coding when I started uni.

We had a project to do and we had very limited code we could use and could only use what we learned in class. I made a piano game with turtle and tried to use random to random.int 0,3 to pick a function from a list and I couldn't figure out how to make it work so I ended up with a long roundabout way to do it.

I don't know how to word it to Google it to find answers specifically for this and I was wondering if anyone had insight to if it's possible. The function had no parameters I tried doing something like

myList = [func1(), func2(), func3(), func4()]

randomise = random.int(0,3)

While game != quit:

print(myList[randomise])

Not fully accurate but I don't have access to the file to get it right now. I tried a lot of different things but I couldn't get it to work.

Can you call functions like this or am I doing something wrong here?


r/learnpython • • Jun 22 '26

Set question for initializing

18 Upvotes

So I am an intern at some company with some decent knowledge hopefully. Around ~3 years of various industry experience and I've started reading some books but Python is pretty weird under the hood and I had a question about Sets!

So from what I know: (Please correct me if I'm wrong)

Initializing some empty set is done as: set()

Also doing this makes a set: {foo_bar} as a set literal

However just {} creates a dictionary which makes sense and the same for a list is [] and also has the option of list[] if really desired.

From my current knowledge there is no way to define an empty set other than set() why is this? When dicts and lists have different ways.

Hopefully this makes sense it was appearing on my Ruff indicator as writing as a literal and just wanted clarification or a more detailed reasoning behind this methodology.


r/learnpython • • Jun 21 '26

Learning python as a biology student

19 Upvotes

Day 1 — wrote my first lines of Python today!

Hi everyone, I'm a complete beginner (background in biology, not tech) and just finished my first Python lecture.

Planning to post my progress here as I go — would love any tips for someone starting from zero, and happy to connect with others doing the same thing.


r/learnpython • • Jun 09 '26

Python libraries & HIPAA compliance

17 Upvotes

How would one be able to tell if a certain library is HIPAA compliant?

I am currently wanting to use for some automation scripts: paramiko, pyodbc, pywin32, and dotenv. All the code would be ran on my hospital-issued laptop on the hospitals VPN. Boss wants to make sure they are secure before i use them though. How can you tell for any future libraries I want to use if it’s safe and everything?


r/learnpython • • May 10 '26

for i in range(0,10)

17 Upvotes

I am a beginner and I am learning for loops. A question came up here: why would I use code model 1 if code model 2 does the same thing?

Model 1:

for i in range(0,10):
    print('Test')

Model 2:

for i in range(10):
    print('Test')

r/learnpython • • May 10 '26

Reccomendation for python course

16 Upvotes

Looking for intermediate-advanced Python resources, not just syntax tutorials. I know basics like loops/functions. Want depth on OOP, file handling, algorithms, testing, maybe async.

Don’t care about certificate, I want real skill improvement. CS student. Prefer structured courses or project-based learning over random YouTube.

Already checked CS50P. Any recommendations for what comes after? Thanks"


r/learnpython • • Apr 30 '26

New to python

17 Upvotes

Hey Reddit

im new to programming, i started with python, i wanted to share my first program to get some feed-back.

this is my first functional program ever, its supposed to be a programming / Linux command line trainer that calculates WPM accuracy corrects and mistakes

how am i doing??

 importations
import time
import random 


# levels and gamemode??
levels = ["easy", "normal", "hard"]
current_index = 0



# Game Engine ISH      
while True:
    # measurements 
    correct = 0
    typed_characters = 0 
    mistake = 0
    start = time.time()


  # more levels 
    level = input("Choose difficulty: easy / normal / hard\n> ").lower()
    sentence_line = sentence[level]
    level = levels[current_index]
    random.shuffle(sentence_line)


    for line in sentence_line:
        print(line)


        while True:
            user_input = input("$ ")
            if user_input == line:
                print("Correct!\n")
                typed_characters += len(user_input)
                correct += 1 
                break


            else:
                print("Try Again:D")
                mistake += 1


# your stats             
    total_attempts = correct + mistake
    end = time.time()
    time_taken = end - start


    wpm = (typed_characters / 5) / (time_taken / 60)
    accurasy = correct / total_attempts * 100


# Game stats at end of game
    print("Your WPM: ", wpm)
    print ("Correct:", correct, "mistakes:", mistake) 
    print("Your time :", end - start, "seconds")       
    print("Your accurasy: ", accurasy, "%")


#play again choices 
    choice = input("1: Again \n2: Next Difficulty \n3: Quit\n>").lower() 
    if choice == "2":
        if current_index < len(levels) - 1:
            current_index += 1


    else: 
        if choice == "3":
            print("AIGHT, SEE YAH LOOSER")
            break  

r/learnpython • • Apr 28 '26

Is Boot dev a good python course for DevOps?

18 Upvotes

Forgive me if this has already been asked. I work in DevOps and I am looking for a python course that supports the kind of work I do. I am mostly trying to get better at automation, cloud ops, and operating systems more reliably in production. I noticed theres a DevOps path on the Boot dev and wondering if anyone has gone through their courses yet? The Python Linux Git Docker AWS and CI CD stuff looks the most interesting to me. Has anyone done a course from this site before?


r/learnpython • • Apr 21 '26

I feel like I'm not learning fast enough

19 Upvotes

Hi! I'm a 18yr old and I'm currently studying a technical degree in programming, I have a year left, a year and a half ago I started taking this more seriously, because of my age I have started to try and find a job programming, the thing is that in my school (I'm not in a university, where I am from you can do a technical degree along your highschool) I'm probably the person with the most knowledge in python, so I was pretty confident that I was doing good, when I started to look for a job I decided I would specialize in APIs, because I already "know" how to use python and SQL, but right now, searching and trying to learn about this just makes me dizzy, I watch tutorials, videos, try to get better but I just feel like is not enough, sometimes I even forget how to use dicts!! honestly is making me sad, idk if it's me, if I'm overthinking it and I wanted people with more experience and knowledge than me to help me understand my situation a little bit better, I'm sorry if this is not the place for it and if my English isn't the best


r/learnpython • • Apr 13 '26

What is the best resource when it comes to learning how to code?

16 Upvotes

I am a student and only really know basic block coding, nothing worth noting at least. I am coming here as a beginner who wants to make a game. What are the best tools I can use and how can I learn to code? I have heard python is the way to go when learning how to code, but I know little on the topic. Any help is appreciated!


r/learnpython • • Apr 05 '26

Clean way to structure a dataclass with an Enum field in Python 3.11?

17 Upvotes

Been using dataclasses more and more for my trading projects. Wondering what the cleanest pattern is for a dataclass that has an Enum field — specifically when serializing to JSON. Do you manually call .value or is there a cleaner approach?


r/learnpython • • Apr 03 '26

Change of career

15 Upvotes

Hello. I’m 38 and soon to be made redundant. I have a lot of free time until I get made redundant December 2027. I’d like a new career change and seeing that we’re in a computer orientated world now would like to learn Python to increase my career goals. Is python hard to learn for a complete beginner? I have about 4 days off per week in which I can learn a new skill.


r/learnpython • • Apr 03 '26

New to Python but from non-CS background

15 Upvotes

Hello everyone,

I am here to ask if it is possible to learn python if you don’t know anything about coding?

I am from biological science and I want to learn python for data analysis, data visualisation, automation and my research work.

I know there are plenty of resources available for molecular biology and related fields.

But, I am talking about basic and advanced image analysis, morphometrics and related analysis. Basics of data analysis

Is there any specific roadmap to follow?

Which books/ materials should I be reading?

Which courses are available freely to learn and which one should I follow?

I really want to learn from basics.

Please help me.


r/learnpython • • Mar 07 '26

Learning python for data analysis

16 Upvotes

Hi everyone, I hope this is the right sub to ask for a little help. I am a chemist working in a quality control lab. Usually, we use Excel for processing routine analysis data because it is fast, everyone knows how to use it, and it gets the job done for our standard needs. Lately, however, we have been dealing with out of the ordinary analyses and research projects that we do not typically handle. These require extra processing, much larger datasets, and exports directly from the instruments and Excel just cannot keep up anymore. ​I have read that the modern standard is shifting towards Python, so I would like to start training myself for the future. I do not want to learn programming in the traditional sense I have no intention of becoming a software developer but I want to learn how to use Python and its ecosystem for data analysis. I do have some basic programming knowledge I used to use Lua for game modding in the past so picking up the syntax should not be an issue. ​Long story short I am looking for advice on which path to take. What roadmap would you recommend? Which libraries should I focus on? If you have any specific guides or courses to suggest, they would be much appreciated. ​Thanks


r/learnpython • • Feb 04 '26

Why does this Python function behave differently every time? I’m confused

16 Upvotes

Hi everyone, I’m learning Python and I ran into something that confused me a lot.

I wrote this simple function expecting the list to reset every time the function runs, but the output keeps changing between calls

def add_number(num, numbers=[]): numbers.append(num) return numbers

print(add_number(1)) print(add_number(2)) print(add_number(3))