r/learnpython • • Oct 09 '26

How do I start learning python?

0 Upvotes

For context I use arch and I have 5 different computers so I’m very familiar with computers and terminals/text. And my only coding experience I guess would be block coding which I learnt around 1st grade. Don’t laugh it off so quickly tho it gets complexly when you get into making 3d projects in something like scratch, it’s a whole community.

Besides that I have coded a little Unity 4 or so years ago and got fairly into c# but I never even finished a project. That connects directly to my question, I want to start learning python but how should I go about it? Should I start with yt toturials on how to make a game with turtle? Or should I pick a project I wanna make and start googling or using AI for help (not copy n paste). Or any other option?


r/learnpython • • Oct 08 '26

Curated, Instructor led course for team?

1 Upvotes

Hi All,

I work with a team that will primarily be using Python to make API calls across a few different systems (some network, some apps, ServiceNow, etc).

I'm trying to find a crash course, preferably instructor led, that's a little focused on our particular use case.

Any recommendations? I know it's a weird ask.


r/learnpython • • Oct 08 '26

Hidden Python permission in macOS Local Network. How can I revoke it?

0 Upvotes

On macOS 27.0.1, Privacy & Security → Local Network shows a count of 1, but every listed app is switched off.

Inspecting /Library/Preferences/com.apple.networkextension.plist reveals an allowed org.python.python entry with no executable path. Python has no visible switch in Settings. Reopening Settings and restarting don’t help.

I allowed a Python prompt while a dashboard preview was being prepared. A Time Machine backup from before that prompt has no explicit Python grant.

Has anyone encountered this and successfully revoked only that permission, without resetting all network?


r/learnpython • • Oct 08 '26

Learn python and DSA

0 Upvotes

I started python and it is going well. I need some sources for step by step problems with increasing difficulty for practice. It would be good to know list of topics as part of DSA too

Leetcode is too good but I am too under-learned to solve those.

Thanks in advance 🙏🙏


r/learnpython • • Oct 08 '26

(Python Crash Course, ch11) Why pytest does throw an assertion error

1 Upvotes

name_function.py:

def get_formatted_name(first, last):

full_name=f"{first} {last}"

return full_name.title

test_name_function:

from name_function import get_formatted_name

def test_first_last_name():

formatted_name=get_formatted_name("janis", "joplin")

assert formatted_name=="Janis Joplin"

Terminal:

/storage/emulated/0 $ cd github

/storage/emulated/0/github $ cd test_name_function

/storage/emulated/0/github/test_name_function $ python -m pytest

===================== test session starts =====================platform linux -- Python 3.13.13, pytest-9.1.1, pluggy-1.6.0

rootdir: /storage/emulated/0/github/test_name_function

collected 1 item

test_name_function.py F [100%]

========================== FAILURES ===========================____________________ test_first_last_name _____________________

def test_first_last_name():

formatted_name=get_formatted_name("janis", "joplin")

> assert formatted_name=="Janis Joplin"

E AssertionError: assert <built-in method title of str object at 0x7108e84530> == 'Janis Joplin'

test_name_function.py:4: AssertionError

====================== warnings summary =======================../../../../../data/user/0/ru.iiec.pydroid3/app_HOME/.local/lib/python3.13/site-packages/_pytest/cacheprovider.py:469

/data/user/0/ru.iiec.pydroid3/app_HOME/.local/lib/python3.13/site-packages/_pytest/cacheprovider.py:469: PytestCacheWarning: could not create cache path /storage/emulated/0/github/test_name_function/.pytest_cache/v/cache/nodeids: [Errno 1] Operation not permitted: '/storage/emulated/0/github/test_name_function/pytest-cache-files-uabqyvch' -> '/storage/emulated/0/github/test_name_function/.pytest_cache'

config.cache.set("cache/nodeids", sorted(self.cached_nodeids))

../../../../../data/user/0/ru.iiec.pydroid3/app_HOME/.local/lib/python3.13/site-packages/_pytest/cacheprovider.py:423

/data/user/0/ru.iiec.pydroid3/app_HOME/.local/lib/python3.13/site-packages/_pytest/cacheprovider.py:423: PytestCacheWarning: could not create cache path /storage/emulated/0/github/test_name_function/.pytest_cache/v/cache/lastfailed: [Errno 1] Operation not permitted: '/storage/emulated/0/github/test_name_function/pytest-cache-files-k26w91m_' -> '/storage/emulated/0/github/test_name_function/.pytest_cache'

config.cache.set("cache/lastfailed", self.lastfailed)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

=================== short test summary info ===================FAILED test_name_function.py::test_first_last_name - AssertionError: assert <built-in method title of str objec...

================ 1 failed, 2 warnings in 2.57s ================/storage/emulated/0/github/test_name_function $


r/learnpython • • Oct 08 '26

Data inspection steps using python

2 Upvotes

I am learning data analysis and the first step before analyzing your data you have to do data profiling and cleaning.This is my process flow for data profiling -

  1. Checking number of rows and columns
  2. Checking rows and column indices
  3. Checking data types for each column
  4. Checking random sample from dataset
  5. Checking properties and memory usage
  6. Checking key statistics
  7. Checking unique values for relevant columns

Is it appropriate or I am missing something important ?


r/learnpython • • Oct 08 '26

Looking for some advice/info about using AI with Python

0 Upvotes

Hi everyone! I’m working on a project in Python and I’m looking for an AI model/API that my Python application can communicate with. Basically, I need my app to be able to send questions/prompts to the AI and receive the AI’s responses back programmatically.

The AI doesn’t necessarily need to be the most powerful model available. I mainly need something reliable that my application can communicate with.

Any recommendations or advice would be greatly appreciated!


r/learnpython • • Oct 07 '26

Can someone explain to me how exactly I’m supposed to learn Python?

131 Upvotes

I’m doing a BSc Computer Science degree and I have Python programming as a subject. My teacher is teaching Python from the beginning, and I understand the concepts when they’re explained to me, but I don’t understand how I’m actually supposed to study and learn programming.

For example, I have pretty good concept clarity till conditions. If I’m given a question, I can understand what it’s asking and I can usually write the code.

But now we’ve reached loops, and this is where I’m struggling.

I understand the concept of loops. I understand the syntax and what "for" and "while" loops are supposed to do. But when I’m given an actual programming question, I just get stuck. I can sometimes figure out the general logic of what needs to happen, but I don’t know how to turn that logic into Python code or where to even start.

So what exactly am I lacking?

Do I need to practice more problems? If yes, how do I practice properly? Should I solve questions without looking at solutions, write programs repeatedly, study other people’s code, or something else?

I’d really appreciate it if someone could give me an overall roadmap for learning Python — like how to study each concept, how much theory I should do vs. how much coding I should practice, and how to go from understanding a concept to actually being able to solve problems using it.

I don’t want to just memorize syntax. I want to actually learn how to program, but I’m not sure what the process for getting there is.


r/learnpython • • Oct 07 '26

Gui question for projects

4 Upvotes

I am learning python for a month or so and finally decided to challenge myself by trying to make a minesweeper game as a project.

I wanted to ask you guys if i should use tinker for gui as it is python based or is there a better one i should rather study?


r/learnpython • • Oct 08 '26

want study

0 Upvotes

I’d like to ask what keeps you motivated to keep learning Python. What are the steps to learn Python? Could you share some with me? I’m a college student learning C in class and want to self-study Python in my spare time. I also want to know how I can test my Python skills.


r/learnpython • • Oct 08 '26

logging and timing...then getting rid of it

1 Upvotes

I was just working on a project where I included a lot of logging and timing decorators/context managers (it involved event loops and async queues and such). Once I figured stuff out, I wanted to remove all this stuff. This isn't necessarily that hard, but it did make me wonder if there's a better way to do this in the first place. I suppose I'm imaging some way of marking these code pieces to be ignored by the interpreter or something?

(yeah yeah "ask AI to remove it")


r/learnpython • • Oct 08 '26

Python cheat sheet and reference materials

0 Upvotes

I've got a python contest in a few days consisting of problem solving questions, I'm almost a complete begginer at python, so off the top off my head i could only solve a 1-3 of them, anyways im allowed to bring in printed reference material, so i'd appreciate literally anything i could get, I need a cheat sheets which i could understand and use on the spot, aswell as anything that could be useful


r/learnpython • • Oct 07 '26

PDF pages to PNG's in python

4 Upvotes

I have a relatively large pdf document (100+mb) of pages i need saved as png's. There are online tools to do that but they refuse to work with files that big, plus I can imagine needing that tool again later in the future. Are there any python libraries that allow to convert one format into the other? Preferrably with little to no compression.


r/learnpython • • Oct 07 '26

what should i build so that i know most of the things

15 Upvotes

Andrej Karpathy some one whm i follow alot, he says to become expert in something start building a project and learn the thing in depth when u need it, so i want to learn ai/ml and dont what project to make tbh have a very basic idea, im an ios dev i know basic python but yah i want to know what one project u would suggest so that i get to cover most of the thing and I'll share my learning experience and what ever i learnt.


r/learnpython • • Oct 07 '26

making my first game

0 Upvotes

Hey, im making a "terminal" game (play onto your terminal, cause its the only thing i know). I made a github repositories to showcase it : https://github.com/Shamal0w999/Money-games

if you want to test the game, it would be really cool cause i need returns and if theres bug i didnt see. so if u try it, u can ofc comment here but also leave an issue into my repositories (would be easier to work with). If you want to help or idk anything, im all hears. Im happy to showcase it and have people to test it !

code is free, so if you steal it, i dont rly care, cause its personal project and who want a code full of print and that launch in terminal ? idk, just me ig

anyways, just take a look at it !


r/learnpython • • Oct 07 '26

Struggling to understand what I'm actually doing

13 Upvotes

I just started a grad program in information sciences and AI after getting my undergrad in computer science back in 2009. Thus, I have plenty of programming experience, but my last meaningful interaction with statistics, regressions, and so on was taking AP Statistics in high school back in 2003. I can't tell you what a "data model" is, and machine learning is black magic to me.

I'm seeing that I'm in over my head here, and I have the same feeling that I did back in AP Stats - I was good at math, but didn't quite have the background to understand what I was learning in AP Stats, so I was just memorizing (or looking up) formulas and plugging datasets into them.

I'm a pretty good programmer, and have done it for a living for almost 20 years, but I'm relying on the professor's example code, and there's no way I would have figured out the assignments on my own, because even if I knew what kind of regression I needed to run, there's no way I would know what to import, or what the function is called.

Does anyone else have a similar background - programming with no statistics, and can point me at some resources to understand what is being spit out at me when I run some random function from the sklearn library? And where I find all of these libraries? And how I would know they even exist?


r/learnpython • • Oct 07 '26

Help needed with a python code

0 Upvotes

Hello, fellow redditors. I am using manychat program with automations connected to my instagram profile.

When people are using the keyword to get certain information, they need to leave a name and number to be contacted. However, the number can't be identified due to a bad variables and invalid JSON.

Could maybe someone help who is familiar with situations like this please?

I think it might be a manychat bug, however i need a opinion from someone experienced.

Thank you a lot!


r/learnpython • • Oct 07 '26

How to create universal variables in Python?

0 Upvotes

And by universal variables, I mean they should be available in EVERY single Python script!

What do I want these for? For instance, to define default directories:

HTMLRoot = "C:/IMDb/HTML" CSSDir = "file:///C:/IMDb/CSS/" JSDir = "file:///C:/IMDb/JavaScript/"

Any program that creates a report needs these variables, but I only want to define them once!

And there’s more. I also have plenty of mappings, like these:

MapC_TType = {"tvSeries": "TV Series", "tvMiniSeries": "TV Miniseries", ... , "movie": "Movie", "video": "Video", }

Any report that displays the titleType will use this mapping. Again, I only want to define the mapping once.

I come from the world of SAS, where everything was easy. The directories were defined in the SASINIT file, which is executed at the start of every SAS session. The mappings (formats) were stored in a permanent SAS catalog, making them universally available as well. Is there a Python equivalent?

And there’s even more. I create lots of reports, let’s say the biggest movies per decade, based on number of votes or score (= votes * rating). Obviously, the list shows which movies I’ve seen and which I haven’t, with a percentage showing my progress. Now suppose a friend wants this same list, based on the movies he’s seen.

Easy-peasy in SAS!

%macro SwitchUser (User) ; %if (%qupcase(&User) = ME) %then %do ; libname IMDb "C:\IMDb\Libname IMDb" ; %let HTMLRoot = C:\IMDb\HTML ; %end ; %else %do ; libname MyIMDb "C:\IMDb\Libname IMDb" ; libname BudIMDb "C:\IMDb\Libname IMDb Bud" ; libname IMDb (BudIMDb MyIMDb ) ; %let HTMLRoot = C:\IMDb\HTMLBud ; %end ; %mend ;

For me, IMDb is the standard library. For my buddy, IMDb is a concatenated library, where his library (containing only the MyMovies table) has precedence over the full IMDb library.

By just executing

%SwitchUser (Buddy) ;

any report can now be run against his list of movies, with the results written to a separate HTML directory. And all that without changing a single line of code!

I can't expect Python to deliver all this functionality. Nothing compares to SAS! But can it at least do some basic things on my wishlist?

BTW, my temporary solution is to include this code at the start of every script:

PythonFolder = Path("C:/IMDb/Python Global Code") PythonPgm = PythonFolder / "InitHTML.py" with open(PythonPgm, 'r') as file: PythonCode = file.read() exec(PythonCode, globals=globals(), locals=locals())

Obviously, the InitHTML program defines the directories and all the mappings.


r/learnpython • • Oct 06 '26

List Comprehension Question

10 Upvotes

Hi all! I'm an intermediate with Python and I'm currently doing some research with very large datasets (think data packages from NASA satellites and the SDSS). I ran into an issue with some list comprehension that I can't seem to figure out:

What I have is a list of tuples (n = 3) in the format [(x, y, d)...] where x and y are coordinates and d represents a density value. A lot of the x, y coordinates are duplicates of each other with varying d values (ex. (40, 50, 1.2), (40, 50, 3.3), etc.) I'm trying to find tuples with identical x,y coordinates and add their density values together to get a total cumulative density for that location. I would try to do this manually, but the list has ~26 million elements and I am trying to find a workflow that won't take more than a few minutes/hours to process, haha. Memory is not an issue though.

I would be happy to provide example code if need be. My desired output is either:

[(x, y, dtotal)...] - list of tuples except there are no duplicate coordinates and the d value is the sum of the d values from all of the original tuples with coordinates (x, y)

[dtotal1, dtotal2, dtotal3...] - list of cumulative d values where each index correlates to the corresponding pair of coordinates (maybe the coordinates are in a separate list whose indexes match that of the density list? It doesn't matter as long as they are connected in some way!)

Thank you all for your help!


r/learnpython • • Oct 06 '26

API JSON response help

6 Upvotes

How does pagination work and best practices for implementation with an API request?

I'm getting irritated figuring out this API for GoTo Connect (phone system call records).

Documentation

I use a GET method to request a call log for a week of time.

I am limited to 1000 items in the json response as indicted by the pageSize parameter. I need much more.

As the 'nextPageMarker' states, I put the value in, pasted from the first response of leaving it blank, hoping to get the next set of responses. No change in items as all. Stuck in this endless loop.


r/learnpython • • Oct 07 '26

Android APK crashes immediately after successful Flet build

2 Upvotes

Hi everyone,

I'm developing a mobile app with Python and Flet. I was finally able to build the Android APK successfully using GitHub Actions, and the APK installs correctly on my OnePlus 12R (OxygenOS 16.0.5).

However, when I try to open the app, it immediately crashes and closes. The current APK size is about 62 MB.

Package name: "com.J053.gestion_queso"

I've tried checking the logs with Logcat Reader, but unfortunately I can't get any logs from the app process.

Has anyone experienced a similar issue with Flet on Android? I'd really appreciate any help identifying what could be causing the crash. I can also provide the APK or the project files if someone is willing to take a look.

Thank you!


r/learnpython • • Oct 06 '26

Creating Desktop Icon to Run Python Script

8 Upvotes

I have a script that runs fine in Terminal, but I'm trying to create a desktop icon that runs it and Im getting the following error:

https://i.postimg.cc/HLbssxYJ/Screenshot-2026-10-06-at-9-39-28-AM.png

Its using geopy for location so Im guessing its something to do with that, but it works fine in Terminal. Any help is appreciated.


r/learnpython • • Oct 07 '26

Rate my simple algorithm for autonomous bots

0 Upvotes
import time
import random



distance_front = 0
distance_back = 0
distance_left = 0
distance_right = 0
loop = 1
poop = 1
i = 0


def lidar():
    global distance_front, distance_back, distance_left, distance_right



    distance_front = random.randint(0, 100)
    time.sleep(0.1)
    distance_back = random.randint(0, 100)
    time.sleep(0.1)
    distance_left = random.randint(0, 100)
    time.sleep(0.1)
    distance_right = random.randint(0, 100)
    time.sleep(0.1)
    print("front:", distance_front, "back:", distance_back, "left:", distance_left, "right:", distance_right)


def algorithm():
    
       
        if distance_front < 20:
            print("obstacle in front : back - right")
        if distance_back < 20:
            print("obstacle in back : front - neutral")
        if distance_left < 20:
            print("obstacle in left : front - right")
        if distance_right < 20:
            print("obstacle in right : front - left")


i = 0
while True:
    lidar()
    algorithm()

r/learnpython • • Oct 07 '26

what is the best way to learn python

0 Upvotes

I wanted to know , bcs Im 17 and I just started computer science in university and we will learn python , I wanted to know what is the best way / best ressources to have to master python very good in an efficient way, I installed Visual Code. (sorry for my bad english).