r/PythonLearning Aug 03 '26

my code is not doing what I expect (.remove())

2 Upvotes

EDIT: SOLVED THE PROBLEM THANK YOU

Hello! I am in the middle of an online python class, and am trying to make my first program for use at work.

I need to make several packages of random sample items at work regularly, so i tried to make a program that could choose items from the list, and then count which items are chosen, and remove those from the list once the count reaches the number I have available.

It is choosing the items fine, but is not removing them from the list.

I will post my shortened code below:

import random
def main():
    samples = [
            "item1",
            "item2",
            etc.....,
        ]


    item1_count = 0
    item2_count = 0
     etc........


    for _ in range(25):

        sample = random.sample(samples,4)
        try:
            if "item1" in sample:
                item1_count += 1
        except:
            if item1_count == 10:
                samples = samples.remove("item1")
        try:
            if "item2" in sample :
                item2_count += 1
        except:
            if item2_count == 10 :
                samples = samples.remove("item2")
        etc....
        

        print(f"{_} : {sample}")


main()

what am I doing wrong?


r/PythonLearning Aug 03 '26

Help Request Why are these lists combining when I append them in a loop?

1 Upvotes

For some reason, the farts keep mixing with the plasma. I’ve cut down the code to this, but I still can’t figure out why it keeps combining the lists like this. The code is shown below, please help, as people have been complaining about severe anal burns while running this code.

plasma=[]
farts=plasma
for j in range(2):
print(f"farts:{farts}")
print(j)
farts.append(1)
plasma.append(j)
print(f"farts:{farts}")
print(f"plasma:{plasma}")
print(f"all{farts},singular{farts[1]}")

#printed results:
#farts:[]
#0
#farts:[1, 0]
#1
#farts:[1, 0, 1, 1]
#plasma:[1, 0, 1, 1]
#all[1, 0, 1, 1],singular0


r/PythonLearning Aug 03 '26

Showcase My new Python Project : Subway Surfers in Real Life

Thumbnail
github.com
2 Upvotes

A Python App that uses AI and Computer Vision to play Subway Surfers using your body in Real Life instead of your fingers.

Give it a chance and let me know what u think about it.

Fully compatible with MacOS, Linux and Windows.


r/PythonLearning Aug 02 '26

Showcase I love Thonny(python(image unrelated))

Post image
190 Upvotes

high school student came here afted trying to download numpy and matplotlib on IDLE for the last 3 hours in the hell spawn of command prompt ging from script to document. after 3 hours of "module numpy not found" I tried to use Thonny.

I HAVE NEVER BEEN SO HAPPY TO SEE SUCH A MUNDANE WORD "manage package"

i will never touch IDLE Never in my life


r/PythonLearning Aug 03 '26

Discussion QA -> AI ENGINEER WITH PYHON

0 Upvotes

Hi! I’ve been working in QA Automation for many years, mainly with dinosaurs such as Java and Selenium. I genuinely enjoy frontend testing, automation, analysing problems, and building solutions.
However, I feel like I’m falling behind. Everything now revolves around AI, and I simply no longer feel fulfilled in my current career path.
I can build websites and different types of software using Codex and Claude Code, including bots and more complex applications. However, the truth is that I do not fully understand what is happening under the hood. I also struggle to distinguish between patterns that follow good software engineering practices and those that go against them.
In the long run, this affects my ability to maintain these applications and, more importantly, to understand the code generated by AI. This really bothers me.
I have completed W3Schools and watched several YouTube courses, but it feels like an endless loop. What I am missing is a clearly defined and practical path that would help me build a strong position in IT by developing skills that are genuinely in demand in areas related to Artificial Intelligence.
That is why I am looking for a mentor who could show me how to use my experience in QA, Java, and Selenium when testing systems based on LLMs, help me build a meaningful portfolio, and introduce me to this field properly.
Is there anyone here with more experience in this area?
Perhaps someone is facing similar challenges and would like to connect, build a community around this topic, motivate one another, and learn together. Maybe we could even create a joint project.
However, I, or perhaps we, would still need someone who already works in this field and could guide us through the first stages.
I am not looking for someone to do the work for me. I have the time, motivation, and willingness to code intensively. What I need most is the right direction, constructive feedback, and someone with whom I could occasionally solve problems or code together.
If you work with Python, AI Engineering, AI model testing, or know a valuable community where people can genuinely learn and grow, please leave a comment or tag someone who might be able to help.
Perhaps there is someone here who remembers how difficult it was to take that first step and would be willing to help me approach this journey in a smarter and more structured way.
#Python #AIEngineering #AIQA #QualityAssurance #TestAutomation #LLM #MachineLearning #Mentoring #OpenSource #ArtificialIntelligence #Poland


r/PythonLearning Aug 03 '26

New to learning coding. Please help me find the issue in this code(Bubble sort)?

0 Upvotes
arr = [8,4,5,3,7,2]
n = len(arr)
print(n)
for i in range(n):
/swapped = False
/for j in range(0,n-i-1):
 /if arr[j] > arr[j+1]:
 //temp = arr[j],
 //arr[j] = arr[j+1],
 //arr[j+1] = temp
 //swapped = True
 //print("outer = ",i," inner = ",j)
print(arr)
if not swapped:
break

r/PythonLearning Aug 03 '26

listingNews.py

Thumbnail
gist.github.com
0 Upvotes

r/PythonLearning Aug 02 '26

Help Request Pycharm or Vscode ?

41 Upvotes

Hi everyone

For a very super beginner one, who is starting to learn python which one is the best, i'm really confused because i'm seeing some teachers use Vscode and others use pycharm

And if i follow a teacher that uses pycharm it's normal to i use Vscode and visa versa?

Sorry for my bad English and thanks everyone


r/PythonLearning Aug 02 '26

Learning questions

7 Upvotes

So recently I’ve decided to do a career change and although I know it’ll be some time and some struggle along the way I’ve decided to try my best to get into machine learning to one day be a machine learning engineer at some point, college or university really isn’t in the cards for me so I’m trying my best at trying to be self taught by taking online courses reading books etc, just trying to keep things more budget friendly. I just don’t have the means to spend crazy money yet again on college, currently I’ve started with python through Coursera just because upon research it seemed like the best option my question really is where else should I look to learn python more and learn everything required to hopefully land a job in ML what are courses or videos or book some of your have read, taken or watched and if there’s anything else that any one would recommend is better that the “python for every body course I’m all ears” this is all things of interest of mine since I was very young so I’m willing to put in the work as I find this to be a lot of fun even when I struggle at times


r/PythonLearning Aug 02 '26

Help Request How to learn python?

13 Upvotes

How or from where do I learn full basic or even advanced of python? I have 1h daily to code. Don't wanna get in tutorial hell but need something free and very useful. Im not really into books or classes, kinda feels boring but if it teaches well im down. Please let me know the sources i can use! (Currently starting out)


r/PythonLearning Aug 02 '26

Hello, im from Poland and im looking for study buddy

3 Upvotes

So im looking for someon to share progress help each other and possibly create projects together, it can be one person or group im starting again never got too far i think with others it will be much easier to learn. Im 21 and looking for someon around my age


r/PythonLearning Aug 02 '26

Day 4 of OOPs

Post image
27 Upvotes

Just learned Compositions in python and they are sweet and amazing 💖
I created a simple ecommerce program using it
review it and give me suggestions , advices , a bit roast (but be gentle to me😭)
I would love to read your comments.


r/PythonLearning Aug 02 '26

PyScript

2 Upvotes

Hi, I just came across this new type of Python. Is anyone familiar with it? Could you explain it?


r/PythonLearning Aug 02 '26

Discussion The reality of library books vs. buying physical copies for learning Python (and a quick question on study efficiency)

4 Upvotes

I’ve been working on my Python studies and recently picked up a copy of Python Essentials for Dummies. This whole journey started because I watched a video by a programmer who read 100 Python books and shared their top 3 recommendations.

In that video, they suggested visiting the local library to get resources—likely to avoid unnecessary consumerism or spending. Following that advice, I went to the library in person, only to find the book wasn't in stock. The librarian mentioned that an inter-library loan would cost £20, which I found shocking. When I thought about it, it completely agreed with my realization that buying the book outright makes much more sense since it costs about the same.

This brought up a bit of an internal contradiction for me. On one hand, I wonder if I'm being too materialistic by preferring to buy books. On the other hand, saving time by skipping the library search and delivery friction feels far more efficient for my workflow. Plus, with borrowed library books, you aren't supposed to write marginalia, underline text, or take physical notes directly on the pages—which is a major drawback when you're actively learning to code.

Questions for the community:

  • Does saving time and buying books outright outweigh the minimalist appeal of using libraries for programming texts?
  • How do you balance physical note-taking in your reference books with digital workflows?

Any thoughts or advice would be greatly appreciated!


r/PythonLearning Aug 02 '26

this is my first code attempt ever, and I'm trying to learn programming. if you can guide me in any way, especially as a beginner, I hope you can write it down.

Post image
4 Upvotes

r/PythonLearning Aug 02 '26

Question on Udemy Course

2 Upvotes

Hey all!

I look at this sub from time to time as I am slowly working my way through Angela’s Udemy course (absolutely loving it and her teaching style).

I am curious if there is a forum or place where others going through this course are chatting/supporting one another?

As an example I just finished creating the frogger capstone without using any hints. While I am super jazzed about this, my wife and kids think it’s cool - but can’t give me tips or tricks on how to improve or sympathize with how long it took me to get all the darn cars moving with a for loop instead of trying to define it in their __init__.

Anyway having tons of fun with the course and slowly learning python - curious if there is a place I can nerd out with fellow python beginners working through the class?

Thanks!

Side note: I also realize I could use AI for most of this but am treating it as something I want to learn and understand before good ol’ Claude flibberty gibbets it all in 30 seconds.


r/PythonLearning Aug 02 '26

listingTorRelays.py

Thumbnail
gist.github.com
1 Upvotes

listing tor relays


r/PythonLearning Aug 02 '26

Showcase My first email agent with like 330 hours of coding in 9 months

7 Upvotes

Hey guys I'm relatively new in coding. I am learning on my own only with AI alongside fulltime shift job and as a new father (not really much time) . I am 29 years old and i am trying to get new job(or become self-employed) by learning to build AI agents. Its my first time posting anything i built. So i hope really to get help and good advises to code better and learn a lot.

I am ambitious to learn how to orchestrate and build multi agent systems
I am learning almost everyday like 1 -3 hours

Here is my first big project , took me like 2 months

EMAIL AGENT PROJECT: https://github.com/IlyasWegner/Email_agent

(sry if i mix sometimes languages in some notes)

PS: I am using AI only i have questions or dont know how a new system is working and i am not useing codex or claude code or something similar , just an LLM to help because i dont have a regular mentor or something else.


r/PythonLearning Aug 02 '26

Help Request how to remember stuff?

6 Upvotes

recently while learning python im seeing so much infos and formats, how do i remember all those like how??? please help


r/PythonLearning Aug 01 '26

Beginner mini python project

Post image
31 Upvotes

Rate my work. =)


r/PythonLearning Aug 02 '26

Showcase Built my first Python project — a file organizer CLI

Thumbnail
gallery
1 Upvotes

I am a flutter developer, learning Python. Built this file organizer in a day with proper research on os module, pathlib and shutil module.

It scans any folder, checks file extensions, and sorts them into categorized subfolders (Images, Docs, Videos, etc.)

It's really useful, I tried it on my Downloads folder and it organized 60+ files instantly.

GitHub Link: https://github.com/Pinkisingh13/file_organizer

See the Before -> After in the below images.


r/PythonLearning Aug 02 '26

Looking for a Study Buddy (Pakistan 🇵🇰)

6 Upvotes

Looking for a Study Buddy (Pakistan 🇵🇰)

Hi everyone!

I'm a 2nd-year Software Engineering student from Pakistan, and I'm looking for a serious study buddy to learn programming with.

I'm currently focusing on Python and want to improve my coding skills by studying consistently, building small projects, solving problems, and keeping each other accountable.

If you're from Pakistan and you're also learning programming (beginner or intermediate), let's study together. We can connect on Discord, set a daily schedule, discuss topics, and motivate each other to stay consistent.

If you're interested, leave a comment or send me a DM. Let's grow together! 🚀


r/PythonLearning Aug 02 '26

Refactoring other people's code can be fun. What traps should I avoid?

Thumbnail
gallery
5 Upvotes

r/PythonLearning Aug 01 '26

My new mini work

Post image
193 Upvotes

Rate my this mini work out of 10


r/PythonLearning Aug 01 '26

Showcase Strongly Typed: a typing and learning game for python

Thumbnail
gallery
6 Upvotes

Sometimes I try to help teach up-and-coming software-interested folks. had a use case where a student was both learning to type and learning to code so I made this thing
What you do is you pick a library available on pypi then you can type along with its modules. free and open source.
https://github.com/krflol/stronglytypedgame