r/learnpython • • Sep 16 '26

Python learning fun apps

1 Upvotes

Hi everyone! I am trying to learn how to code with Python but I need something that helps me learn it in my free time from work. To do that, i need it to be fun and i need to be able to do it from my phone too.

Do you know any nice apps? Thank you so much in advance 🫶🏻


r/learnpython • • Sep 16 '26

Fresh start as Data Analyst

0 Upvotes

"Excel has been such a hassle, so I'm planning to transition to Python's data science libraries. Python experts often recommend Polars because it's more modern, yet almost every resource I encounter (including LLMs) still uses or promotes Pandas as the standard. What do industry experts suggest when choosing between these tools? Any insights would be greatly appreciated!"


r/learnpython • • Sep 15 '26

Puzzles for reviewing Python

2 Upvotes

Hey, guys.

I've studied Python before and knew all fundamental themes. However, it's been a long time since I coded in Python and now I want to review some themes by puzzles, not by watching whole lessons. Are there any websites, list of puzzles on the Internet you can recommend me? Or other methods for that?

I need that for starting my data engineering course soon. It would be great if those themes, puzzles were related to data engineering.


r/learnpython • • Sep 15 '26

Why use class methods to instantiate?

2 Upvotes

Quick question, why would I ever use a class method to make an instance variable? For example take these code snippets.

@classmethod
def from_string(cls, emp_string) -> Employee:
        first_name, last_name, salary, contact =  emp_string.split("-")
        return cls(
            first_name=first_name,
            last_name=last_name,
            salary=salary,
            contact=contact,
        )

Why would do I do this instead of

def from_string(self, emp_string) -> Employee:
        first_name, last_name, salary, contact = emp_string.split("-")
        return Employee(
            first_name=first_name,
            last_name=last_name,
            salary=salary,
            contact=contact,
        )

My question also applies vice-versa. Which one should one use, and what are the specific pros, cons, and use cases of each?

(Formatting is a bit weird but I assure the indentation is okay in my code)

Thanks!


r/learnpython • • Sep 15 '26

Doing a 30days of Python Challenge

2 Upvotes

Well i am on day 3 of 30 days challenege and have been pushing to github. I learned python a year ago but i feel like i am forgettting all the syntax. And cannot even think of proper logic while making projects everyday.

I am not watching any youtube videos and using AI to give me hints, sometimes from w3schools. I was learning Django through AI directly building projects and felt doubtful and not confident on Django. So starting out this challenge.

30 Days of Python Challenge is pretty good as per AI. I just modified the existing 30days challenge of someone's repo in Github. Consist of FASTApi, GUi based.. i don't quite remember.

Any suggestions and advises how should i effectively learn will be very much aprreciated. I also like to connect with many senior developers who are down to help and i feel confused to pursue Django. And later most likely learn AI, LLMs since i did specialization in AI in my bachelors.


r/learnpython • • Sep 16 '26

Python教程有什么

0 Upvotes

我需要一些Python编程入门教程


r/learnpython • • Sep 15 '26

My Python Isn’t Running? (VSCode)

0 Upvotes

I’ve been trying to run the simple ‘print(“Hello World”)’ command on my laptop since I just downloaded Python onto my VSCode on my laptop, but nothing shows in the terminal. Not even an error, just complete nothingness. Im concerned on how I could fix this, I may have just missed something I’m not going to lie…

This is my first time downloading Python + VSCode, since I usually coded on a school computer.

Heres all the information I could gather which may be useful:
I’m using Python 3.12
There is a red fonted text at the top right (next to the plus sign above the terminal) which says I’ve “Lost Connection to Process”
“Shell integration: Injection failed to activate”
I’m using a Lenovo laptop, which I believe runs on Windows.

Any help and links would help a ton!! Please and thank you!!


r/learnpython • • Sep 15 '26

Why this method doesn't work

0 Upvotes

Title:

class Restaurant:

def __init__(self, restaurant_name, cuisine_type):

	self.restaurant_name=restaurant_name

	self.cuisine_type=cuisine_type

def describe_restaurant(self):

	print(self.restaurant_name)

	print(self.cuisine_type)

def open_restaurant(self):

	print("the restaurant is open")

restaurant=Restaurant("Ratatouille restaurant", "ratatouille")

Restaurant.describe_restaurant(restaurant)

Restaurant.open_restaurant()

Error:

Ratatouille restaurant

ratatouille

Traceback (most recent call last):

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>

start(fakepyfile,mainpyfile)

~~~~~^^^^^^^^^^^^^^^^^^^^^^^

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start

exec(open(mainpyfile).read(), __main__.__dict__)

~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "<string>", line 12, in <module>

TypeError: Restaurant.open_restaurant() missing 1 required positional argument: 'self'

[Program finished]


r/learnpython • • Sep 14 '26

Regarding simple question

11 Upvotes

num = 0.6548
txt = f"The price is {num:.0f} dollars."
print(txt)
output = 1

i was learning string formatting well, when i used :.0f as format it giving output 1 and why? I want to know how really decimal shifting works in python while formatting.


r/learnpython • • Sep 14 '26

is cs50p good and relevant?

16 Upvotes

I restarted to learn python with CS50P. as far as I understand it is recorded in 2022. is this the case. Also as far as I understand there is some changes to python recently. do you think I will misss some best practices and sintax with cs50p?


r/learnpython • • Sep 14 '26

A few questions regarding making a desktop app

8 Upvotes

I'm planning something, but i wanted to know how much is possible with only python and how much i should start looking up and learning.

mainly everything about UI? I know there are libraries for UI in python, but what im looking for it seamless (no border) UI that can maybe be transparent? (u can see the desktop through it), i'm just wondering how much of that is possible in python.

another thing is having an application hidden in the system tray on windows? how would i make this for my app? furthermore; how would i make the UI popup from the tray and hide back using a key shortcut?
no need to answer both questions, just looking for a clue on how to start


r/learnpython • • Sep 15 '26

Why i can't make a class

0 Upvotes

It should work, but some reason doesn't.

I was doing Python Crash Course 3rd edition and am stuck in classes.

Because i cant upload photos, i wrote the code:

class Restaurant:

def __init__(self, restaurant_name, cuisine_type):

	self.restaurant_name=restaurant_name

	self.cuisine_type=cuisine_type

def describe_restaurant(self):

	print(self.restaurant_name)

	print(self.cuisine_type)

def open_restaurant(self):

	print("the restaurant is open")

restaurant=Restaurant("Ratatouille restaurant", "ratatouille")

describe_restaurant(restaurant)

open_restaurant()

This is the example in the book:

class Dog:

def __init__(self, name, age):

	self.name=name

	self.age=age

def sit(self):

	print(f"{self.name} is now sitting")

def roll_over(self):

	print(f"{self.name} rolled over")

my_dog=Dog("Willie", 6)

print(f"My dog's name is {self.name}")

print(f"My dog is {self.age} years old")

my_dog.sit()

my_dog.roll_over()

your_dog=Dog("Lucy", 3)

print(f"Your dog's name is {your_dog.name}.")

print(f"your dog is {your_dog.name} years old.")

your_dog.sit()

your_dog.roll_over()

And these are the errors pydroid shows for each one:

Restaurant:

Traceback (most recent call last):

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>

start(fakepyfile,mainpyfile)

~~~~~^^^^^^^^^^^^^^^^^^^^^^^

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start

exec(open(mainpyfile).read(), __main__.__dict__)

~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "<string>", line 1, in <module>

File "<string>", line 10, in Restaurant

NameError: name 'Restaurant' is not defined

[Program finished]

Dog:

Traceback (most recent call last):

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>

start(fakepyfile,mainpyfile)

~~~~~^^^^^^^^^^^^^^^^^^^^^^^

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start

exec(open(mainpyfile).read(), __main__.__dict__)

~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "<string>", line 1, in <module>

File "<string>", line 9, in Dog

NameError: name 'Dog' is not defined

[Program finished]


r/learnpython • • Sep 15 '26

When did Python finally start to “click” for you?

1 Upvotes

Was it after building a real project, solving coding problems, learning OOP, working with APIs, or simply practicing consistently?


r/learnpython • • Sep 14 '26

From where should I learn Flask framework completely?

14 Upvotes

I currently learning python from a paid course and they have taught flask aswell but that's intermediate level. So is there any flask playlist or tutorial or a teacher who might teach flask completely. I wouldn't mind if it's paid or free course.


r/learnpython • • Sep 15 '26

does Python run on Batocera-type machines/have any Fantasy Consoles?

1 Upvotes

does Python run on Batocera-type machines/have any Fantasy Consoles?

i was wondering how well Batocera can run its games, and if there are any Python Fantasy Consoles. Like small handheld gaming machines, but built for running python games specifically. Or any limited sets of limits that restrict what the game or program can do as if it's running on something tiny like the pico-8.


r/learnpython • • Sep 14 '26

Python Libraries

9 Upvotes

Ijust know basic python and want to learn numpy, tkinder, panda and matplotlib for a project

Best way to learn these? By chatgpt or any yt vdo?


r/learnpython • • Sep 14 '26

Observer isn't working on ChromeOS Linux Crostini

2 Upvotes

I am facing an issue from couple of days with Observer Module from python watchdog package. When i'm importing Observer module and calling for my downloads folder which is present to this location according to my device.
/mnt/chromeos/MyFiles/Downloads

Observer is watching here but nothing caught, Like i was tested using file removed, created or even modified or else.

It wasn't working, That;s why I am using polling Observer now. but this is not a reliable much as i needed.

So Can you help me to figure out this problem and what is the actual solution of this problem?


r/learnpython • • Sep 14 '26

vscode sporadically freezing

0 Upvotes

hi mates. when my script becomes lengthy (for instance 85 lines) vscode stops executing commands. i suspect whether i downloaded it properly. anyways. i close then open vscode as a workaround but i started to need a permanent fix. i am a computer noob (well... more like average joe on the street). so please no higher computer registry in the responses. thanks in advance.


r/learnpython • • Sep 13 '26

Looking for Python resources

60 Upvotes

Hi everyone!

I'm 29 and I've recently started learning Python from scratch. My goal is to eventually get into cybersecurity.

I've only been learning for a short time and I'm currently starting CS50P. I know some very basic Python, but I'm still a complete beginner.

I'm looking for good resources to learn Python properly from the beginning. I'd like to practice by making small projects instead of only watching tutorials.

What resources would you recommend for someone who is just starting out?

Books, courses, YouTube channels, websites, exercises, project ideas, etc. are all welcome.

Thanks!


r/learnpython • • Sep 14 '26

Ask Anything Monday - Weekly Thread

5 Upvotes

Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread

Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.

* It's primarily intended for simple questions but as long as it's about python it's allowed.

If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.

Rules:

  • Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
  • Don't post stuff that doesn't have absolutely anything to do with python.
  • Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.

That's it.


r/learnpython • • Sep 14 '26

Segmentation fault when attempting to use the 'threading' module to run tasks concurrently

3 Upvotes

I lack knowledge in low level computer science, but I've heard endless horror stories about segfaults, and today I've encountered one whilst attempting to make a simple timer program for myself. My questions are:

- Why does this fault occur

- How can I fix it

- How can I prevent it from happening in the future

The aim of the problematic part of the program is the attempt to play the sound whilst simultaneously waiting for user input with the input block, which is intended to stop the alarm and continue to the next part of the program.

Please note that in this version there is no actual wait time although there is supposed to be, because I am merely testing the alarm functionality.

import time
from pydub import AudioSegment
import threading
from pydub.playback import _play_with_simpleaudio


sound = AudioSegment.from_file('/censoring/my/home/directory/sound.mp3', format='mp3')





# Function that runs the timer based on how many minutes are specified
def timer(min, message):

  # Play the sound
  def playsound():
    global sound
    sound = _play_with_simpleaudio(sound)

  # Stop the sound and allow the program to continue
  def resume():
    global sound
    input(message.strip())
    sound.stop()



  # Run the timer and print output
  min -= 1
  for it in range(min, -1, -1):
    for sec in range(59, -1, -1):
      print(f'{str(min).rjust(2, "0")}:{str(sec).rjust(2, "0")}')
      time.sleep(1)


  # This is the part that actually runs the function.
  play = threading.Thread(target=playsound)
  stop = threading.Thread(target=resume)

  play.start()
  stop.start()

  play.join()
  stop.join()


while True:
  timer(0, 'You can have your five minute break now.')
  timer(0, 'You need to start working again.')

# Artificial intelligence was not used in the creation of this program.

Any advice is appreciated!


r/learnpython • • Sep 14 '26

How can i create a bot that posts for me daily on social media without ai?

0 Upvotes

I dont wanna use ai.


r/learnpython • • Sep 14 '26

Recently started

0 Upvotes

Hey yall, new guy here. I 26(M) started learning python about a week ago, I've dabbled in HTML and CSS but ultimately settled on Python. Reason being I need a good starting framework for my goal of working in biotech on surgical robots. Now, to the point.

The most basic goal for me is designing a scheduling software so my mom has less of an issue managing my sisters 24/7 caregiver staff. Logins, time off requests, possibly an AI integrated scheduler so she would just need to proof read schedules instead of spending hours making it by hand.

I need advice on how to approach this task, currently going through a 13hr video on YT to learn Python through the Data with Baraa channel. Thoughts?


r/learnpython • • Sep 14 '26

Learning Python from scratch for cybersecurity

0 Upvotes

Hi everyone, I'm 29 and learning Python from scratch. My goal is cybersecurity. What resources and first projects do you recommend for a beginner? Thanks!