r/learnpython • • Nov 11 '25

How to pretend I'm using pointers in Python?

6 Upvotes

Sometimes for fun/practice I do Leetcode-style problems in C. I would like to be capable of doing some of the same stuff in Python if possible.

One thing that makes me hesitant to do Leetcode stuff in Python is the lack of pointers.

There are lots of algorithms to do with arrays/strings that use pointers. For example, to reverse a string in C without allocating more memory, you use a double pointer technique starting with one pointer pointing to the front of the string and one pointer pointing to the back.

I know that Python does not have pointers in the language and that design choice makes sense to me. Is there a way to sort of fake it, so that I can take the algorithms that I've learned with C and apply them to Python?


r/learnpython • • Jan 30 '24

Can I use python to protect my pdf file so people can only read it and not copy the texts from it?

7 Upvotes

I need help. Not opt for password but just readers are able to read it without able to copy the texts. What other alternatives other than Adobe Acrobat?


r/learnpython • • Apr 04 '24

I was so euphoric starting python but was disappointed with gui tools

7 Upvotes

I have a background on 20+ years of coding java/php/swift/Js etc. And i was so excited to know more abt tensors and neuron networks, so i finally decided to dig into python which i always found ugly (too used to the C coding style) But i was happy and found that it works!! Panda library makes arrays like an excel sheet. And lot of cool stuff.

Of course i directly went into the object oriented style and making my own packages and classes.

And very quickly i wanted to make GUI as i was tired of running my code in console and writing parameters by hand… and there is when things started to get disappointing.

After many readings i tried the pyside6 library, wich was working but dunno why it was a variant of pyqt and there were some licensing weird details. But i figured out how to make it run.

Then, i of course came to the point where i need my gui to make async calls for some cpu intensive tasks. And this was hell… no documentation, no straight forward way to make it work. And especially so many libraries exists that are abandonned and not maintained wich start making me feel i was on the bad path.

And in this trial and error step i discovered that python is basically mono-cpu language and since it’s interpreted it makes it half the speed of the same php code and up to 500 slower than a C code. (Something i discovered when i found out Cython).

Then all of the sudden i was confused, why people chose this language for neuron networks wich is one of the most cpu intensive coding thing??

I was also digging pytorch and the CUDA library and also found that everything work in some sort of tweaks here and there (wich is nornal since the core of python is moni-cpu).

And finally, i came accross the venv folder, (i started with conda) and realized this folder can reach many gigs of bytes, it reminded me of the node_module in js coding. And there knew that it would be a hell to make a lightweight portable exe file out of my python script. While it was one of the main motivation to start python is to be able to build offline desktop apps

So thats where i am. I hope i am wrong with all the disappointments i listed and that i can find my initial enthusiasm for coding python.

All of your comments are welcomed

UPDATE: Thx for all your inputs it really helped a lot. I figured out that PySide6 used natively async threads with QThread and i have tested it and seems great. Ui does not freeze and the code could detect all the 16cores of my macos and run parallel tasks on them. I am going to stress test the tool to check its limitations. Pyinstaller could generate a 60mb one executable file that runs a ui with all the pyside6 code.

Tutorial found here if anybody is interested: https://realpython.com/python-pyqt-qthread/


r/learnpython • • Jun 27 '26

​I forget everything I learn after a day. Is AI giving me the right advice?

8 Upvotes

Hi everyone,

​I just started learning Python and I’m feeling stuck. I can't seem to memorize anything. If I practice something today and try to write it from scratch tomorrow, I completely forget it.

​I asked an AI assistant about this, and it told me that the right way to become a programmer isn't to memorize code. Instead, it advised me to learn just the basics (like variables, loops, lists), and then build projects by copying/pasting ready-made code structures and modifying them to fit my needs.

​As experienced programmers, is this advice true? Am I supposed to feel this lost at the beginning, and is copying/modifying code a legit way to learn?

​Thanks!

EDIT / UPDATE:

​Thank you so much to everyone who commented! I have read all of your comments and found every single piece of advice incredibly helpful.

​English is not my native language, so it is a bit difficult for me to reply to each person individually, but please know that I deeply appreciate your guidance.

​I will take your advice seriously: I am going to stop copying and pasting, step back, and focus heavily on understanding the logic and practicing the basics by writing the code myself.

​Thank you all for being such a supportive community! 🙏


r/learnpython • • Dec 08 '23

In all honesty, do you think it’s waste of time to learn programming languages nowadays considering all the layoffs?

0 Upvotes

Last year I spent months learning SQL and Tableau because I was interested in junior data analytics roles. For over a year, I sent out over a thousand applications, had dozens of interviews, but no offers. It felt like a complete waste of time. Now with all the layoffs and the fact that there are tens of thousands of experienced professionals in tech looking for jobs, is learning Python and JavaScript in hopes of finding a job worth it or is it just a waste of time?


r/learnpython • • Oct 11 '25

Got a Python Intern Assessment in 30 Hours!!!

0 Upvotes

Heyyy everyone,
I’ve got an onsite Python Developer Intern assessment coming up in about 30 hours. I have been practicing a few problems using ChatGPT, and the HR mentioned there will be “a total of 10 questions based on basic Python logic, libraries, and dictionaries.”
Any last minute tips or guidance would mean a lot! 🙏


r/learnpython • • Jun 03 '26

Using ai generated code?

0 Upvotes

I have been learning python for about a month or so. I’ve been learning a lot every day, and I enjoy learning it. But as you may know vs code has the git hub copilot ai assist. Is using this acceptable in 2026 in the ai automation job environment or just any programming job in general? Like this thing can pretty much do what ever you tell it. It knows exactly what’s wrong right when the error happens. Am I coding wrong? Is this acceptable to use? If there’s any real developers out there I’d love to hear from you!


r/learnpython • • May 16 '26

Manipulating a CSV file and making it into a JPG

0 Upvotes

I have a CSV file and I want to, using a python script, add colour & change font to bold in certain cells under certain conditions, then export as a JPG.

Example of some of the general thing I want to do is:

  • If value above x ammount in cell B3 then background colour green.

  • If cell A2 contains the word 'Win' then make bold.

  • All row 1 font size set to 14. All other cells 10.

That sort of thing.

Is this possible using Python? I'm guessing it is. If so how?

Many thanks for the help.


r/learnpython • • Jan 16 '26

What beginner Python mistake took you the longest to understand?

2 Upvotes

I keep seeing the same beginner mistakes again and again.

For me it was:

  • indentation errors

  • confusing lists and tuples

  • forgetting to return values from functions

Curious what mistakes confused you the most when you were starting.


r/learnpython • • Sep 24 '26

How do I get back into coding with Python?

0 Upvotes

I've taken a long hiatus (3+ years) from programming. I'm 20 now, and I'm looking to get back into it.
What are some things I should try doing to get back into the groove?


r/learnpython • • Aug 23 '26

Learn Python

0 Upvotes

Please help me learn Python, I'm really passionate about it At first I found it boring, but now I find it incredibly good.


r/learnpython • • Jun 16 '26

¿Como empiezo con python?

2 Upvotes

Me gustaría aprender programación y escuche que es mejor empezar a aprender con python, pero no se como empezar, eh visto varios tutoriales y cosas por el el estilo pero quisiera saber desde otra perspectiva de alguien que ya cometió errores para saber que si y que no hacer, tambien me surge una pregunta talvez tonta, ¿es necesario aprender en computadora?, porque e visto varias terminales en las que según se puede aprender python en teléfono como termux.


r/learnpython • • Feb 23 '24

Programming jobs with no CompSci degree?

2 Upvotes

I see lots of people say on reddit that loads of the people working in programming jobs at their company don't even have a CompSci degree. They have archaeology or geography or any random degree instead. I am wondering what kind of jobs are these exactly, and in what kind of companies? I am learning programming on my own, and I am looking through indeed and none of the jobs seem particularly entry level, and none of them seem all too willing to employ anyone without a million different qualifications. I'm wondering if I'm looking in the wrong place? Am I searching the wrong keywords or going in with wrong expectations? I see people talking about hordes of people being employed working with computers without the relevant bachelors literally all the time and I've only now realise I have no idea what specific jobs these people are actually doing or how on earth they're getting into them. Thanks


r/learnpython • • Mar 20 '24

Creating an AI trading bot in python, is it possible?

2 Upvotes

I have enough programming knowledge to work on the bot and make the algorithm, only issue is, I don't know how to go about finding a good strategy that will be profitable and implementing in in python, I know its extremely hard I know that, I just want to know how realistic it is to make one in 1-2 months and if there is any open source or known algorithms like this that I can make something similar to, any help will be appreciated.

requirements

" well-known stocks from the S&P 500, NASDAQ, etc. The algorithm for the Bot will be based on historical events, news articles, graphs, and other important factors affecting the stock market. I understand there's always a risk in trading, especially in AI-trading. However, I do occasionally come across bots of this kind that guarantee a minimum of 80% success. Therefore, I'm open to other suggestions regarding the input side of the AI.
Functions:
The user will choose between X amount of versatility (low-medium-high-very high)
The bot will then do trades based in the versatility. Buy at lows and sell at highs.
The more versatile the more risky trades it will execute.
You would also be able to give the bot a threshold. For example: Sell if below X prosent loss/profit"


r/learnpython • • Oct 02 '24

'for x, y in dictionary.items():'

0 Upvotes

1)Im confused. How does python recognize that x and y aren't some random variables but seems to somehow realize exactly that x and y are irrelevant placeholders that it should use as 'key' and 'value'?

Whenever it encounters 'in dictionary.items()' and 'for x, y' before that, is python preprogrammed to understand im not talking about random variables but keys?

2) Is this command just essentially telling it 'for key, a value is attached in x dictionary'? Like, yeah, no shit. Thats what a dictionary is. Why would I need to type this and not be able to just mention the dictionary and simply use':' to create a block from there?

Take this for example:

sequences = {'AGC': 'ATG', 'GGG': 'CCC'}

string7 = 'AGCAGCAAGGG'

string8 = string7

for a, l in sequences.items():

value string8 = string8.replace(a, l)

This is the method chat GPT suggested for replacing segments of a string using a dynamic dictionary.

Why cant I just bring up the dictionary name and essentially tell python that for a specific string, I want it to replace every key it encounters with its value, based on the dictionary I brought up?

Sorry for any crankiness, I've been asking chatGPT for an hour straight to explain this and I am just not able to understand.


r/learnpython • • Jan 01 '26

ROADMAP FOR PYTHON

0 Upvotes

Is this a good roadmap? Phase 1: Python Fundamentals (Months 1-2) Build core coding skills through simple scripts. Concepts to Learn: Variables and data types (strings, lists, dictionaries—for handling backend data). Conditionals (if/else—for decisions like user validation). Loops (for/while—for processing requests or data lists). Functions (reusable code blocks—for backend endpoints). Basic input/output (print/input—for simulating API interactions). Error handling (try/except—for managing server errors). Tools: VS Code, Python interpreter. Projects: Number guessing game (practice loops and conditionals). Simple calculator (functions and input handling). Console-based contact book (store/retrieve data in lists). Daily Structure: 20% reading/docs, 80% coding small examples. Phase 2: Data Handling and Structures (Months 3-4) Learn to manage data, essential for backend storage and APIs. Concepts to Learn: Data structures (lists, tuples, sets, dictionaries—for organizing user data). File I/O (read/write JSON/CSV—as mock databases). Exception handling (advanced try/except). Modules and packages (import code—for using libraries). Virtual environments and pip (setup projects). Tools: PyCharm (free community edition), pip. Projects: Expense tracker (store data in files, basic queries). Student record system (manage entries with dictionaries/files). Daily Structure: Review prior code, learn one concept, build on a project. Phase 3: OOP and Libraries (Months 5-6) Structure code like real backend apps. Concepts to Learn: Object-Oriented Programming (classes/objects, inheritance—for models like User). External libraries (requests for API calls, json for data exchange). HTTP basics (understand requests/responses—for web interactions). Tools: Postman (test APIs), Git/GitHub (start versioning). Projects: Web scraper (use requests to fetch data, process with OOP). Simple API caller (fetch public API data, store in files). Daily Structure: Add Git commits daily. Phase 4: Web Frameworks and APIs (Months 7-8) Dive into backend specifics: Build server-side logic. Concepts to Learn: Frameworks (start with Flask for simplicity, then FastAPI for modern APIs). REST APIs (routes, GET/POST methods, handling requests). Databases (SQLite basics, then PostgreSQL—for storing data). ORM (SQLAlchemy—for database interactions without raw SQL). Tools: Flask/FastAPI docs, SQLite browser. Projects: Basic REST API (Flask app with endpoints for CRUD on items). Task manager API (create, read, update, delete tasks via API). Daily Structure: Focus on debugging API errors. Phase 5: Advanced Backend and Deployment (Months 9-10) Make apps production-ready. Concepts to Learn: User authentication (sessions, JWT—for secure logins). Testing (unit tests with pytest—for reliable code). Deployment (host on free platforms like Render or Vercel). Security basics (input validation, avoid common vulnerabilities). Version control advanced (Git branching). Tools: Docker basics (containerize apps), CI/CD intro. Projects: Full blog backend (API with database, auth, deployment). Weather service API (integrate external API, deploy). Daily Structure: Deploy small changes weekly.


r/learnpython • • Jan 06 '26

Should i write code on an Python Interpreter or should i do it on Terminal

0 Upvotes

I decided to start learning Python lately and i have been using the online interpreter since it felt easier, but i have seen many people using the Terminal or notepads. The problem is i dont understand how to run or highlight the code with colors in Terminal, so i dont really feel like using it. Is there a way to make it better or should i get used to it?


r/learnpython • • Feb 04 '26

Writing professional level python

2 Upvotes

I've only ever used python with scripts, advent of code and leetcode, how can I learn to write python to a professional level, I've worked within web and done some Django tutorials. However I am interviewing and want to use python I am also using it such as

def function(some_param: type):
  
do something
   
return something

def function_2(some_param: type):
  do something
   return something

var = function()
function_2(var)

What should I be doing to make this code look more senior level


r/learnpython • • Nov 25 '24

wait the f up! tensorflow is not supported for python 3.13?!

2 Upvotes

i hope that TensorFlow doesn't phase-out of its popularity cuz that would really suck


r/learnpython • • May 07 '26

I have a Intel chip based MacBook. Will I be missing out if I'm not using an Apple chip based while learning Python, AI, ML

0 Upvotes

Im a software engineer with decade old experience. Learning Python and stuff.

Will I be missing out if I don't have a MacBook with Apple chip In the learning?


r/learnpython • • Jun 29 '24

everybody should try uv, did you try uv?

2 Upvotes

creating venvs, pip operations, they're all free now.... like, we can create a whole new venv and install a hefty list of dependencies and its low-seconds.... uv is to pip what ruff is to flake... it's literally free... just tear down the venv and make a new one - who cares it takes 2 seconds!

dependencies magicaly resolved, in a second!

i was using rye for a while and loved the resolution, but it was pretty slow tbh.... i think uv integrated rye or something, but they also super optimised everything.

you just install it and then instead of eg `pip install` you `uv pip install` and instead of `python -m venv .venv` you just `uv venv`...

honestly the speed has blown my mind.

did anyone else try it? was i just under a rock or is this a gamechanger?


r/learnpython • • Dec 21 '22

i had 19 days of time to learn basics of python

2 Upvotes

Hi guys my lead gave me 19 days of time to learn python.guys can you share your experiences how you learnt and what's are the mistakes you made while learning ? Is this time is sufficient to learn and what's are the topics need to learn and my team mostly working on testing of code like CTC tool for code coverage and astree is used code analyser .


r/learnpython • • May 05 '24

You can’t learn to cook from just watching tutorials

2 Upvotes

As the title implies, my problem is, I have lots of courses to do(CS50, FreeCodeCamp(FCC), Udemy, CS50 Python, etc), I’m indian so I also have some books and their related courses(Sumita Arora, Ncert, etc) the problem however is, their seems to be a big rift between me and the people who can solve problems based on Python and I really don’t enjoy watching these courses or reading these books because I wanna learn from problems,

for example, math and science, I had to study them when I was in 11th&12th and the best way I learned the theory, was by solving it’s problems, the application, I am struggling to find such a connection in Python right now and I think it’d be a waste of my time and energy to continue learning further without first getting rid of this problem, any and all advice is greatly appreciated.

tl;dr, I need a application/question based way to learn python and I can’t find anything like that(further context is above)


r/learnpython • • Feb 05 '24

Interested in Learning Python!!!

2 Upvotes

Hello everybody, I'm new to python. I've never even touched coding before. Where is the best place to start learning.... Thank you!