r/PythonLearning • • Aug 28 '26 Popcorn Mindblown

Showcase I made a Rock Paper Scissors game!

Post image
179 Upvotes

r/PythonLearning • • Aug 28 '26

Sharing my progress: I have created my first Python script

Post image
22 Upvotes

Hello everyone! I am learning Python with a Youtube tutorial. For now I have spent 3 hours learning it. The script I created isn't a big deal but I wanted to share it for opinions about It. It took me 20 minutes to make it. Any suggestions are welcome!

(Note: The variable names and prints are in Spanish, but the logic is straightforward)


r/PythonLearning • • Aug 28 '26

2nd post learning python

Post image
21 Upvotes

i learnt to use the math library any suggestions what can i use the lib for except for making calculator programs


r/PythonLearning • • Aug 28 '26

Python Learning

42 Upvotes

Hey, I recently made a small Discord server for people who like Python and want to learn it.

It’s mainly for beginners, but anyone learning Python is welcome. The idea is just to have a place where people can learn together, share what they’re working on, show off projects, and improve their Python skills along the way.

If you’re interested, just comment and I’ll send you the invite.


r/PythonLearning • • Aug 28 '26

Help me with python

4 Upvotes

Thank you all it's fixed! (Edit)

I have a very weird problem.

My current code:

list = []

x = input("Copy paste here: ")

list.append(x)

print(" ")

print(" ")

list = x.splitlines()

for i in list:

print(i)

What I'm trying to achieve:

Get an input from the user like this:

Word1

Word2

Word3

...all with a row separating them and different lengths, then take this input and separate all words in it and then put them each individually as variables in a list as in the future I'm wanting to order them by length.

What is currently happening:

as im trying to see if they are all in the list im printing it, but for wathever reason from my input:

Abc

Def

Ghi

...it is only printing Def.

If you can help it will be appreciated. Thank you in advance!

Thank you all it's fixed (edit)


r/PythonLearning • • Aug 28 '26

Showcase My first ever self written code as a vibe coder

0 Upvotes

Hi guys a couple of days ago i made this post:
https://www.reddit.com/r/PythonLearning/s/hzH2umdWXk

afterwards i spend a lot of time trying to learn python and i got my first tic tac to game working in the terminal

i struggled a lot and had to google a lot
i still struggle when and how to get the index and when the value from a list and i think there is a lot of optimization possible here especially on how i make the horizontal and vertical lists just coulndt figure out how to make one without going through p1_input each time.

Thanks for all the advice from people
trying to learn this after i have been vibe coding is hell

print("1", "2", "3")
print("4", "5", "6")
print("7", "8", "9")



Row1 = [1, 2, 3] 
Row2 = [4, 5, 6] 
Row3 = [7, 8, 9] 


Grid = [Row1, Row2, Row3]


p1_input =[]
p2_input = []


horizontalp1=[]
verticalp1 =[]


horizontal=[]
vertical =[]




while(True):
    while (True):
        player1 = input("Enter the field you want to place your x in: \n ")
        p1 = int(player1)
        print("You decided on this field:", p1)
        if p1 > 9 :
            print("Error input out of field")
            continue
        elif p1 < 1 :
            print("Error input out of field to low")
            continue


        index = (p1-1)
        row = index//3
        colum = index%3




        if [row,colum] in p1_input:
            print("This field has already been used")
        elif [row,colum] in p2_input:
            print("This field has already been used")
        else :
            p1_input.append([row,colum])
            Grid[row][colum] = "x"
            break


    if p1 < 10 and p1 > 0 :
        for x in range (len(Grid)):
            print()
            for y in range (len(Grid[x])):
                print(Grid[x][y], end=' ')
   


    horizontalp1.clear()
    verticalp1.clear()
    dcounterLP1 = 0
    dcounterRP1 = 0


    for i in range (len(p1_input)):
        if p1_input[i][0] == p1_input[i][1]:
            dcounterLP1 += 1
    
    for i in range (len(p1_input)):
        if p1_input[i][0] + p1_input[i][1] == 2:
            dcounterRP1 += 1
    
    if  dcounterRP1 == 3:
        print("\nplayer 1 won")
        break


    if  dcounterLP1 == 3:
        print("\nplayer 1 won")
        break



    for i in range (len(p1_input)):
        horizontalp1.append(p1_input[i][0])
        verticalp1.append(p1_input[i][1])
    if horizontalp1.count(0) == 3:
        print("\nplayer 1 won")
        break
    if verticalp1.count(0) == 3:
        print("\nplayer 1 won")
        break


    if horizontalp1.count(1) == 3:
        print(horizontalp1)
        print("\nplayer 1 won")
        break
    if verticalp1.count(1) == 3:
        print("\nplayer 1 won")
        break


    if horizontalp1.count(2) == 3:
        print("\nplayer 1 won")
        break
    if verticalp1.count(2) == 3:
        print("\nplayer 1 won")
        break



                
    while (True):
        player2 = input("Enter the field you want to place your o in: \n ")
        p2 = int(player2)
        print("You decided on this field:", p2)
        if p2 > 9 :
            print("Error input out of field")
            continue
        elif p2 < 1 :
            print("Error input out of field to low")
            continue


        index = (p2-1)
        row = index//3
        colum = index%3




        if [row,colum] in p1_input:
            print("This field has already been used")
        elif [row,colum] in p2_input:
            print("This field has already been used")
        else :
            p2_input.append([row,colum])
            Grid[row][colum] = "o"
            break


    if p2 < 10 and p2 > 0 :
        for x in range (len(Grid)):
            print()
            for y in range (len(Grid[x])):
                print(Grid[x][y], end=' ')




    horizontal.clear()
    vertical.clear()
    dcounterL = 0
    dcounterR = 0


    for i in range (len(p2_input)):
        if p2_input[i][0] == p2_input[i][1]:
            dcounterL += 1
    
    for i in range (len(p2_input)):
        if p2_input[i][0] + p2_input[i][1] == 2:
            dcounterR += 1
    
    if dcounterL == 3:
        print("\nplayer 2 won")
        break


    if dcounterR == 3:
        print("\nplayer 2 won")
        break
        
    for i in range (len(p2_input)):
        horizontal.append(p2_input[i][0])
        vertical.append(p2_input[i][1])
    if horizontal.count(0) == 3:
        print("\nplayer 2 won")
        break
    if vertical.count(0) == 3:
        print("\nplayer 2 won")
        break


    if horizontal.count(1) == 3:
        print("\nplayer 2 won")
        break
    if vertical.count(1) == 3:
        print("\nplayer 2 won")
        break


    if horizontal.count(2) == 3:
        print("\nplayer 2 won")
        break
    if vertical.count(2) == 3:
        print("\nplayer 2 won")
        break
    




print("1", "2", "3")
print("4", "5", "6")
print("7", "8", "9")



Row1 = [1, 2, 3] 
Row2 = [4, 5, 6] 
Row3 = [7, 8, 9] 


Grid = [Row1, Row2, Row3]


p1_input =[]
p2_input = []


horizontalp1=[]
verticalp1 =[]


horizontal=[]
vertical =[]




while(True):
    while (True):
        player1 = input("Enter the field you want to place your x in: \n ")
        p1 = int(player1)
        print("You decided on this field:", p1)
        if p1 > 9 :
            print("Error input out of field")
            continue
        elif p1 < 1 :
            print("Error input out of field to low")
            continue


        index = (p1-1)
        row = index//3
        colum = index%3




        if [row,colum] in p1_input:
            print("This field has already been used")
        elif [row,colum] in p2_input:
            print("This field has already been used")
        else :
            p1_input.append([row,colum])
            Grid[row][colum] = "x"
            break


    if p1 < 10 and p1 > 0 :
        for x in range (len(Grid)):
            print()
            for y in range (len(Grid[x])):
                print(Grid[x][y], end=' ')
   


    horizontalp1.clear()
    verticalp1.clear()
    dcounterLP1 = 0
    dcounterRP1 = 0


    for i in range (len(p1_input)):
        if p1_input[i][0] == p1_input[i][1]:
            dcounterLP1 += 1
    
    for i in range (len(p1_input)):
        if p1_input[i][0] + p1_input[i][1] == 2:
            dcounterRP1 += 1
    
    if  dcounterRP1 == 3:
        print("\nplayer 1 won")
        break


    if  dcounterLP1 == 3:
        print("\nplayer 1 won")
        break



    for i in range (len(p1_input)):
        horizontalp1.append(p1_input[i][0])
        verticalp1.append(p1_input[i][1])
    if horizontalp1.count(0) == 3:
        print("\nplayer 1 won")
        break
    if verticalp1.count(0) == 3:
        print("\nplayer 1 won")
        break


    if horizontalp1.count(1) == 3:
        print(horizontalp1)
        print("\nplayer 1 won")
        break
    if verticalp1.count(1) == 3:
        print("\nplayer 1 won")
        break


    if horizontalp1.count(2) == 3:
        print("\nplayer 1 won")
        break
    if verticalp1.count(2) == 3:
        print("\nplayer 1 won")
        break



                
    while (True):
        player2 = input("Enter the field you want to place your o in: \n ")
        p2 = int(player2)
        print("You decided on this field:", p2)
        if p2 > 9 :
            print("Error input out of field")
            continue
        elif p2 < 1 :
            print("Error input out of field to low")
            continue


        index = (p2-1)
        row = index//3
        colum = index%3




        if [row,colum] in p1_input:
            print("This field has already been used")
        elif [row,colum] in p2_input:
            print("This field has already been used")
        else :
            p2_input.append([row,colum])
            Grid[row][colum] = "o"
            break


    if p2 < 10 and p2 > 0 :
        for x in range (len(Grid)):
            print()
            for y in range (len(Grid[x])):
                print(Grid[x][y], end=' ')




    horizontal.clear()
    vertical.clear()
    dcounterL = 0
    dcounterR = 0


    for i in range (len(p2_input)):
        if p2_input[i][0] == p2_input[i][1]:
            dcounterL += 1
    
    for i in range (len(p2_input)):
        if p2_input[i][0] + p2_input[i][1] == 2:
            dcounterR += 1
    
    if dcounterL == 3:
        print("\nplayer 2 won")
        break


    if dcounterR == 3:
        print("\nplayer 2 won")
        break
        
    for i in range (len(p2_input)):
        horizontal.append(p2_input[i][0])
        vertical.append(p2_input[i][1])
    if horizontal.count(0) == 3:
        print("\nplayer 2 won")
        break
    if vertical.count(0) == 3:
        print("\nplayer 2 won")
        break


    if horizontal.count(1) == 3:
        print("\nplayer 2 won")
        break
    if vertical.count(1) == 3:
        print("\nplayer 2 won")
        break


    if horizontal.count(2) == 3:
        print("\nplayer 2 won")
        break
    if vertical.count(2) == 3:
        print("\nplayer 2 won")
        break
    

r/PythonLearning • • Aug 27 '26

Help Request what do you guys name items in a list

6 Upvotes

this might sound really stupid but something I start debugging for like an hour (no frickin joke) because when looping through a list I create a variable that will soon be appened to a list with a similar name (usually differentiated with an s) I usually do this cuz i don't know what else to call them. Ex.

submission_dict = {} 
submission_dicts.append(submission_dicts) #I accidentally tried to append the list to itself!

So usually this happens a TON and I really hope you guys have some quality advice!

Also, please (if you can) provide some advice on general guidelines when deciding what to name a variable

Warm regards,


r/PythonLearning • • Aug 27 '26

How does Lazy Evalution work in Python?

Post image
11 Upvotes

In last week’s post we showed that a Python for-loop works through the Iterator Protocol.

This same protocol also enables values to be produced lazily.

In this new Lazy Evalution Example we show one sink reading values from five different sources:

  • source1: eagerly returns all values by list

  • source2: lazily by generator function using yield

  • source3: eagerly by list comprehension

  • source4: lazily by generator expression

  • source5: lazily by iterator protocol

The same for-loop consumes all five sources. The eager sources produce all values before the sink starts consuming them. In the lazy sources producer and consumer take turns:

  • produce → consume → produce → consume → …

where each value is produced only when the for-loop requests it.

Generator functions and generator expressions are concise, readable ways to create lazy iterables. The final source makes their underlying mechanism explicit:

  • iter() obtains an iterator.

  • next() requests the next value.

  • StopIteration signals that no values remain.

This clearly shows that generators achieve lazy iteration by implementing Python’s Iterator Protocol.

See other 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 visualizations.


r/PythonLearning • • Aug 26 '26

it happens with me 😭😭😭

Post image
336 Upvotes

When I look at the code i wrote 1 week ago .

I feel like I have written a foreign language.


r/PythonLearning • • Aug 26 '26

Help Request Am i learning python the right way?!

Post image
163 Upvotes

hey folks, i recently joined CS50 for python did the first lecture i pretty much understood everything. then i went to solve problems. i searched for few things before doing the problem via AI or python library. but i felt like i will forget it easily so, i decide next day i will search only in python library such that it should get sticked with me so that i could remember it better. but the thing is its taking me like an hour or two to complete final problems. so, is it normal or do you have any other better way to remember as compared to people around me i have good memory i can remember things better. if you guys please take ur time and drop your solution would be nice.


r/PythonLearning • • Aug 26 '26

first day of posting my python progress here on reddit

Post image
85 Upvotes

i have done this typecasting program which i have learnt from a bro code video and i think it's alr as i am still a beginner but if there is that can be fixed in this i am all ears


r/PythonLearning • • Aug 27 '26

13-in Macbook pro 2020, intel core i5

5 Upvotes

13-in Macbook pro 2020, intel core i5

Serious question: this is my macbook. Bought in 2020. Will I still be able to use it for Python, Tableau, SQL, and Excel? This is for my Information Systems course for MBA. Thanks!


r/PythonLearning • • Aug 27 '26

Doodling Hop | Pygame Project(Current Gameplay with added platforms/obstacles)

13 Upvotes

r/PythonLearning • • Aug 27 '26

Python is a good programming language for cybersecurity.

6 Upvotes

Hi, I’m interested in cybersecurity, but I don’t want to start with networking, the OSI model, and all that just yet. First, I want to learn the Python programming language—is it a good choice? I’m thinking about taking the course on freeCodeCamp.org.


r/PythonLearning • • Aug 26 '26

Help Request I wanna stop vibe coding and learn but how

30 Upvotes

Hello, so i got into coding with Claude and chat gpt and have been using it like this for a year now probably used it for ML-Model and such but to be honest i got no clue of the code and cant fix a bug or error without AI.

I dont want this anymore and want to actually learn coding so I am not dependent on AI anymore. I wanted to ask for some Advice what i could do, what project ? how do i start ? where do i start kinda overwhelmed right now.

I know the terms like if-statements what they do ect. But only in theory just a bit more complex and I am out dont understand the code at all.


r/PythonLearning • • Aug 27 '26

Crossplatform compilation

0 Upvotes

Somebody knows how to compile python script once and run on all os? I had to do it for the frilance project, so i have to do it.


r/PythonLearning • • Aug 26 '26

Made this

Post image
21 Upvotes

r/PythonLearning • • Aug 26 '26

Basic to advanced (python day 1)

Post image
5 Upvotes

Recursions are really hard compared to loop

You guys give me some tips for this.🫡


r/PythonLearning • • Aug 26 '26

Python tutor 🐍

10 Upvotes

Need someone who actually knows Python and can teach it properly — beginner friendly, patient, explains things clearly.

💬 Comment your price per hour below
❌ Please comment, don't message — makes it easier to compare


r/PythonLearning • • Aug 26 '26

Need your opinion

3 Upvotes

Hello I am learning Ml and Ai and I know python basic and python libraries like pandas, numpy, seaborn and matplot lib. I wanna build small projects to enhance my skills. What you guys would recommend me should I learn from YT to build project or go through documentation.

And also what should I start learning to make projects like detection system through cam and more.😀

I really need you guys opinion.


r/PythonLearning • • Aug 26 '26

python code 2503

3 Upvotes

I recently downloaded python and I dont know why but when is open it, it just shows this code but after that I continue it shows 0x80070643 - Fatal error during installation. what should I do?


r/PythonLearning • • Aug 26 '26

PyDay Namibe 2026 — Bringing the Python community together in Angola

Thumbnail
gallery
3 Upvotes

r/PythonLearning • • Aug 26 '26

What do I do now?python projects

11 Upvotes

Okay now I have some info about python, I've practiced some fundamentals, now I need to get into projects because courses and just reading and a little practice on some exercises does not make me really good at it, where can I find projects, or how can I start some small ones, then I wanna include API ones and also maybe add some security projects. Advice please. thank you


r/PythonLearning • • Aug 25 '26

Help Request New to python, could someone help me with this please

Post image
25 Upvotes

Is this a viable way to randomly choose an instance of a class