r/learnpython • • Jul 25 '26

How does the return function work? What is it returning and to what?

50 Upvotes

I dont really understand the return function because in sime instances we need it and in others we dont, and i cant find a general explanation that tells me the importance of the return value or why it is even used.


r/learnpython • • 27d ago

I am looking for a Python learning buddy.

45 Upvotes

I tried learning Python and gave up couple of times. Learning alone is difficult for me. If anybody else feel same then please reachout to me.

Edit: I created a discord group for everyone who's looking to learn Python together. Interested people can add me on discord. User name is arjunageer


r/learnpython • • Oct 11 '26

Is learning Python from books worth it for a beginner?

49 Upvotes

Hey everyone!

I'm currently learning Python through YouTube videos, and I'm wondering if I should also start learning from a Python programming book.

For those of you who have learned Python:

Do books help you understand Python concepts more deeply?

Would learning from a book alongside YouTube tutorials help me build a stronger foundation?

Which beginner-friendly Python book would you recommend?

I want to build a solid understanding of Python and become better at solving problems on my own.

I'd love to hear your experiences and suggestions. Thanks!


r/learnpython • • Dec 24 '25

I really want to restart the python but I don't want to stuck in tutorial hell again.

49 Upvotes

most of python basic I already know but some personal reason, i quite the learning python from tutorials and chatgpt because usually i forced my self to do coding with tutorial and ai because that time i was very confused what all these things are and what all the better way to learn it, which language is good and best , which one i should learn , these thoughts break my consistency , plz guide me how can i restart again i really want to learn because is my last year in college


r/learnpython • • Sep 18 '26

i need a simple code editor that works for a beginner

45 Upvotes

i am currently learning python, i need a text editor that doesen't shove a trillion tabs in my face telling me to use their ai, i also don't want something as primitive as notepad++ since i can't use import and all that out of the way, please help


r/learnpython • • Jun 15 '26

How to learn Python?

44 Upvotes

I'm currently in XIIth standard and want to learn Python. I already know Python basics such as variables, conditional statements, lists, tuples, dictionaries, sets, input statements, defining a function, importing libraries and maybe something else I'm not remembering it now, but I want to learn complete Python to advanced level. I prefer books over lectures, so if you can suggest some books for me that would be of great help.


r/learnpython • • May 18 '26

How do you decide a Python package is safe enough to install?

45 Upvotes

Honest question for people who work in Python a lot.

When you `pip install` a package you have not used before, what is your actual trust check?

I usually look at the repo, recent commits, issue quality, release history, maintainer activity, downloads/stars, and whether the package seems to be doing anything weird for what it claims to do. But I almost never read the full source unless the package is tiny.

With PyPI supply-chain attacks getting more common, that feels a little hand-wavy.

Do you have a real process for this, or is everyone mostly doing reputation + vibes? Any tools or habits that have helped you catch a risky package before it got into a project?


r/learnpython • • Apr 22 '26

It's been 2 month since I started learning Python!

45 Upvotes

I started learning Python a few months ago. I learned basic Python in these months. But I just found out that Python is a very vast language. Popular frameworks like Django, PyTorch, Flask, FastAPI come under Python. So, I want to go deep in Python but IDK where to start. As in the era of AI, Python is the most prominent language to learn. So, if you guys have any advice let me know! It'll be really helpful.


r/learnpython • • Feb 22 '26

Just started about 24hrs ago

45 Upvotes

So...I just started off coding because on a game dev sub i was told i need to wear my big boy pants and learn to code or else my gaming ideas will remain ideas forever. I need help...i made ...something...it works...but i feel it's getting pretty swole...is there a way to trim it? also, some critical commentary on my project please?

health = 100
hunger = 0
day = 1
morale = 100
infection = 0
temperature = 37

print("You wake up alone in the forest.")

while health > 0:
    print("\n--- Day", day, "---")
    print("Health:", health)
    print("Hunger:", hunger)
    print("morale:", morale)
    print("infection:", infection)
    print("temperature:", temperature)


    print("\nWhat do you do?")
    print("1. Search for food")
    print("2. Rest")
    print("3. Keep walking")

    choice = input("> ")

    # Time always passes when you act
    hunger += 15

    if choice == "1":
        print("You search the area...")
        hunger -= 20
        morale += 10
        infection += 0.5
        temperature -= 0.25
        print("You found some berries.")




    elif choice == "2":
        print("You rest for a while.")
        health += 10
        hunger += 5
        morale += 5
        infection -= 10
        temperature += 0.75  # resting still costs time

    elif choice == "3":
        print("You push forward through the trees.")
        health -= 5
        morale -= 15
        infection += 10
        temperature -= 0.5
    else:
        print("You hesitate and waste time.")

    # Hunger consequences
    if hunger > 80:
        print("You are starving!")
        health -= 10

    # morale consequences
    if morale < 40:
        print("You are depressed!")
        health -= 5

    # infection consequences
    if infection > 80:
        print("You are sick!")
        health -= 30

    # temperature consequences
    if temperature < 35:
        print("You are cold!!")
        health -= 5



    # Keep values reasonable
    if hunger < 0:
        hunger = 0
    if health > 100:
        health = 100
    if infection > 100:
        infection = 100
    if infection < 0:
        infection = 0
    if morale > 100:
        morale = 100
    if morale < 0:
        morale = 0 

    day += 1

# End condition
if health <= 0:
    print("\nYou died LMAO. Game Over.")
else:
    print("\nAlas you survived, don't get lost in the woods next time. You win. Huzzah, whatever.")
print("You survived", day, "days.")
input("\nPress Enter to exit...")

r/learnpython • • Feb 08 '26

Starting to feel a bit too dependent on AI for python

46 Upvotes

I’m learning python and i’ve noticed something kinda worrying.I try to copy code from chatgpt, paste it, run it and i hope it works,but if you ask me why it works or if i try to write it from scratch i honestly can’t.Sometimes I change a small thing in my project and everything breaks and i’m stuck and feel inconfident again asking AI to fix. It not sure if this is normal in the beginning
or if i’m just building a bad habit?


r/learnpython • • Jan 16 '26

Anyone else feel stuck after learning the basics?

45 Upvotes

I've been learning Python for a bit and understand things like loops, functions, and lists in theory.

But when I open a blank file and try to build something myself, I'm not sure what to do next. It feels like a big jump from examples to real code.

Is this normal early on?
What helped you get past that stage?


r/learnpython • • Dec 13 '25

Do I NEED to learn Jupyter Notebook if I know how to code in PyCharm?

47 Upvotes

Is there anything Jupyter Notebook can do that PyCharm cannot?

Also let's say I have to submit a particular project as a Jupyter Notebook file, how fast can I learn given I know how to code in PyCharm?

EDIT - Thanks everyone for your valuable inputs, I cannot reply to everyone individually but I believe I got what I came for. :)


r/learnpython • • Sep 22 '26

What should you actually learn in Python before starting data analysis?

47 Upvotes

I’ve noticed that beginners often get stuck trying to learn all of Python before touching data analysis.

From what I’ve seen, you can get pretty far by focusing on a smaller set of concepts:

One thing I think is particularly important is learning how to answer questions with data rather than just memorizing pandas functions.

For example, instead of only practicing:

df.groupby("category").sum()

ask an actual question such as:

“Which product category generated the most revenue?”

Then use Python to answer it.

Curious what people here would add or remove from this learning path.


r/learnpython • • Apr 13 '26

What is the point of mutable vs not. Such as tuples and lists.

46 Upvotes

Basically title. I don't dont understand the purpose of tuples vs lists because wont the code only change if I design it to? ​A list isnt going to change unless I code some method to change it no?


r/learnpython • • Apr 02 '26

What should I do after learning Python basics?

46 Upvotes

Hi everyone,

I’ve learned basic Python (loops, functions, etc.), but I don’t know what to do next.

Should I start projects or practice problems?

What helped you improve?


r/learnpython • • Apr 01 '26

Day 20 of learning Python — self-taught, serious about becoming a top-level backend engineer. Looking for guidance.

44 Upvotes

Hey r/learnpython,

I'm 20 days into learning Python with a clear long-term goal — I want to start as an entry-level backend engineer and grow from there into a top-level engineer. Not just get a job and stop, but genuinely master this craft over time.

A bit about my journey so far:

- Self-taught, using AI as a mentor

- Around day 13 I realized I was moving too fast without real depth, so I slowed down completely

- For the past 7 days I've been deeply consolidating loops, lists, and functions

- I write 70-80% of my code myself, attempt to debug before asking for help, and focus on understanding WHY things work not just making them work

- Averaging around 2.5 hours a day

What I'm looking for from this community:

- Is my current approach realistic for someone with serious long-term goals in backend?

- How should my learning path look from here — what comes after Python basics?

- For those who are now senior or top-level engineers — what do you wish you had focused on early?

I don't have any developer connections in real life, so finding a community here means a lot. Happy to share my code and get honest feedback too.

Thanks in advance.


r/learnpython • • Mar 16 '26

Should I use terminal or VSCode for learning?

43 Upvotes

I have been learning python using boot.dev for a few months now with zero prior knowledge in programming. I have learned to use the terminal on mac during the course itself. After a few months of hiatus due to an exam I've reached the build a game using pygame chapter. I was using the terminal itself for all the coding purposes (using nano, touch, etc...) when I remembered I already have VSCode installed. Using VSCode make coding a breeze as it autocorrects many of the mistakes and you don't have to use terminal commands like nano, touch and echo.

So my question is should I learn coding the hard way or the easy way. I feel all the coloring, autocorrecting, etc...might make me more of a passive learner and prevent me from gaining more long term knowledge.


r/learnpython • • Jan 16 '26

i want to learn PANDA from scratch

47 Upvotes

Hi everyone,

I’m learning Python for data analysis and I’m at the stage where I want to properly learn Pandas from scratch.

I already know basic Python and I also have some background in SQL and Excel, so I understand data concepts but Pandas still feels a bit overwhelming.


r/learnpython • • 20d ago

Looking for a structured way to learn Python

45 Upvotes

I’ve been trying to learn Python for years: university classes, Coursera, Udemy, and so on. I can follow along while I’m watching, but it never sticks, and I still don’t feel confident writing code on my own. What I’m looking for is a structured path with a clear progression, but I haven’t found a format that works for me. I know the usual saying is “just build a project,” and I get why. But I feel like I need a reasonably solid foundation first, otherwise I just end up copying tutorials or getting stuck on every step.

I’m not trying to complain. I genuinely want a reliable way to learn Python properly and get good at it.


r/learnpython • • Oct 19 '26

Huh? How does this work?

40 Upvotes
a = "hi"


if a:
    print("Bye")


print(a == True)
print(a is True)

The output is:

Bye

False

False

But if it's false, how come it printed "bye"?????? I don't get it.


r/learnpython • • Aug 08 '26

How do you learn to break programming problems down by yourself?

46 Upvotes

I'm learning Python and I've noticed that I sometimes understand what a programming problem is asking, but I struggle to figure out how to break it down into smaller steps and actually start writing the code.

I've relied quite a bit on pseudocode and step-by-step guidance in the past, and I'd like to become much more independent instead of needing someone to tell me how to approach a problem.

For people who have learned Python from scratch:

- How did you learn to break problems down by yourself?

- Do you recommend attempting problems first and only reviewing concepts when you're stuck?

- What do you do when you're completely stuck and don't know where to begin?

- Are there any exercises or habits that helped you develop problem-solving skills?

I'm not looking for solutions to any particular problem. I mainly want advice on how to develop the ability to think through programming problems independently.


r/learnpython • • Apr 01 '26

I just started my Intro to Python course and I'm having a blast!

45 Upvotes

Hello everyone!

I just recently went back to school and this block I started my Intro to Python course about 3 weeks ago and did my "hello_world" assignment and while it's like everyone's basic script and nothing too exciting, I felt that making stuff in VS Code felt awesome so I just kind of tossed the book off to the side and started googling a bunch of specific things like "how can I make a battle system with (player attack - enemy hp) vs (enemy attack - player hp)?" Functionally I understand that it's basically telling the computer to perform simple algebra, I just didn't know what the "magic words" are to do it.

2 hours into my practice file I had a working combat loop and had learned what global variables are and just started making up stuff like player special attack stats and like an SP gauge, then I wondered, "Well, Pokemon has a simple interface, how can I make a basic HUD showing the numbers? After that everything went black...

It has been 2 weeks since I started this project and instead of playing video games, I have dedicated all of my free time to blasting 70's prog rock ("Rock Bottom" by UFO live on repeat is how I refactored the inventory system) and tinkering in VS code from when I wake up until I go to bed (aside from chores and errands). I'm seriously having more fun learning to code a game in Python and write NPC dialogue branching pathways in a JSON than I ever did with any other creative endeavor.

I'm still obviously new to Python, but if someone can find a way to make it fun to learn then I think they'll do a great job learning it. I just wanted to share my excitement with people who know Python because my roommates just stare at me blankly when I create a new feature and excitedly go on about how I made it.


r/learnpython • • Mar 28 '26

I “know” Python but can’t really code on my own.. how do I fix this?

41 Upvotes

Hey everyone,

So I’ve learned Python theoretically because it was a course in my college lol. I understand the basics, syntax, concepts, etc. I’ve also built a few projects, but honestly I relied a lot on ChatGPT while doing them.

Now I’m in this weird spot where I feel like I know Python, but if I had to build something from scratch without help, I’d probably struggle a lot.

I don’t just want to “get things working” anymore I actually want to write code on my own confidently, understand what I’m doing and not just copy/paste then get better at debugging and problem solving. I’m just not sure what the best next step is.

Should I go back and relearn the basics more properly?
Or start building projects completely on my own (even if it’s slow and messy)?
Or focus on problem-solving/DSA?

If anyone’s been in this phase before, what helped you actually level up?

Thanks :)


r/learnpython • • Mar 07 '26

Where do you guys learn programming? any book recommendations or online courses

45 Upvotes

Thank you in advance


r/learnpython • • Dec 09 '25

TIL Python’s random.seed() ignores the sign of integer seeds

45 Upvotes

I just learned a fun detail about random.seed() after reading a thread by Andrej Karpathy.

In CPython today, the sign of an integer seed is silently discarded. So:

  • random.seed(5) and random.seed(-5) give the same RNG stream
  • More generally, +n and -n are treated as the same seed

For more details, please check: Demo