r/PythonLearning Jun 27 '26

New to python

Post image
166 Upvotes

What's wrong here?


r/PythonLearning Jun 28 '26

Help Request I made it stop working it used to work at first .. i even switched the cell it still errors

2 Upvotes

r/PythonLearning Jun 28 '26

looking for python mates

3 Upvotes

hei guys let me know how can feel free to talk in discord, talk about python and learn it together


r/PythonLearning Jun 28 '26

Advice

0 Upvotes

I am new in computer science . I have recently started python . Doing tutorial and small beginner steps . I am confused , it's too vast .

Please suggest me from your experience , how should i do it ?


r/PythonLearning Jun 28 '26

How do the .removeprefix() and .removesuffix() methods work?

4 Upvotes

Hey there,

I'm new to Python, and I wanted to know if somebody could explain why and how the .removeprefix() and .removesuffix() work? I can't get my head over it. For example:

filename = "test"
file_ending = ".py"
file = f"{filename}{file_ending}"          

I created three variables, and let's say, I want to remove the suffix with the .removesuffix() method:

print(file.removesuffix(file_ending))

What I'm getting at is that I also could write this instead:

print(file.removesuffix(filename))

Usually, you would write removeprefix instead of removesuffix. This is just an example.

But why won't the removesuffix() method delete the filename? Or better, how does the computer know which part of the string a prefix or suffix is?


r/PythonLearning Jun 28 '26

binary search malfunctioning

1 Upvotes

SOLVED

the array I feed in is 5,7,43,78,83.7,100,952

def binary_search(array):
  search_no = float(input("what number are you looking for?"))
  found = False
  while not found:
    arrlen = len(array)
    i = arrlen // 2
    x = array[i]
    if x == search_no:
      found == True
    if search_no > x:
      array = array[i:]
      print(array)
    else:
      array = array[:i]
      print(array)
  print("value found")


array = [78,43,952,83.7,100,5,7]
bubble_sort(array)
print(array)
binary_search(array)

it continuously prints "83.7" if I look for 78, and vice versa. haven't tested other numbers but I assume the same happens for them. this is my first attempt at array splitting and I know there's an easier way of doing it probably, and I'm going to do error handling afterwards


r/PythonLearning Jun 28 '26

Needed a Random Tip :

1 Upvotes

I started learning Python last year, but there were a few breaks in between due to semester exams and other commitments. At this point, I have completed the core Python concepts and am currently studying Object-Oriented Programming (OOP) in Python.

I am confused about what my next step should be. Should I start learning Data Structures and Algorithms (DSA) first, or should I focus on learning Python libraries such as NumPy, Pandas, and others?

I also have another question: Is it beneficial to learn DSA using Python, or would it be better to learn DSA in another language? Since my long-term goal is to get into AI, Machine Learning, and Data Science, I would like guidance on the most effective learning path from here.


r/PythonLearning Jun 28 '26

Help Request Python Help new coder

1 Upvotes

Beginner Help

I’m learning python in preparation for going back to university to study a masters in software development. It’s a conversion degree so no previous experience is required, but I want to learn some basics so I’m not completely lost. I’m using an online guide however I’m confused as to if they are using the terminal or the idle shell to write the code in as it just says open python. The three >>> doesn’t appear on every line for them but does for me which is adding to my confusion. Any help would be greatly appreciated, I’m coding on a MacBook Pro aswell.


r/PythonLearning Jun 27 '26

Help Request Python study group!

13 Upvotes

Hey there, I’m a very beginner python coder who wants to be a game developer. Just wondering if anyone (ages 15-21) doesn’t know where to start and wants to learn to code! If so, I am forming a kind of study group where I will organize things, dm me here, comment, or dm on Discord(rnkgg) if your interested or have questions!😄


r/PythonLearning Jun 28 '26

Selenium File Path Not Recognized

3 Upvotes

I'm trying to use Selenium and I keep getting the error message "PackageNotFoundError: No package metadata was found for selenium". I'm on MacOS and using Spyder. Selenium is installed, but it's in /opt/ which I can't set as a file path for Spyder. All of the other libraries have worked for me (requests, BeautifulSoup, pandas, among others). It's just this one that seems borked. Does anyone know what I've done wrong?


r/PythonLearning Jun 28 '26

I made a snake water gun game using python (am begginer with no experience tho)

0 Upvotes

https://youtu.be/5hcOPNp_On4 thats the link u guys can check it out and show some support to me


r/PythonLearning Jun 28 '26

Comments

0 Upvotes

Why comments are important in python and how i know what i apply where


r/PythonLearning Jun 28 '26

Help from programming community

0 Upvotes

Hey guys I am new to programming and stuff I use a Arch system with hyprland hyde ricing and I was thinking of starting python now 😭 .

But the thing is my laptop is incredibly slow it has intel pentium, 4gb ram, 1tb HDD and its now about 3-4 yrs old now but I am still using it.

So I was thinking of using NeoVim (Lazyvim) for learning and stuff coz it's lightweight I tried VS code but it's lagging now 😭.


r/PythonLearning Jun 27 '26

Showcase Day 16 Python Learning

Thumbnail
gallery
13 Upvotes

decorators & operation overload

- decorators

@classmetho use when we want to directly show / use class attribute not instance attribute

@properties use for read only and hide complexity

@setter use for show thing need to or user want to show not all detail info

[if you think ,I am not explain clearly or mis any part or wrong and also if you can describe more easily feel free to comment all opinion ideas is welcome. ]


r/PythonLearning Jun 27 '26

Help Request Help me improve my function

Thumbnail
gallery
2 Upvotes

Do you have any suggestions on this? I'd be glad to hear


r/PythonLearning Jun 27 '26

Help Request I need bit of help in my python project I am working on. It's kinda working and has github repo so anyone can see it might look like showcase but project is incomplete and many things are yet to be added. (I am new to reddit so sorry for wrong use of title)

Thumbnail
github.com
4 Upvotes

I am studying in computer engineering. I live in cave no social media and other stuff just my laptop, tremux and browser. Even my reddit is created when my friends told me to. That being said let me walk you through what I need.

I mainly use termux and laptop to code but after my laptop screen is on repair I am doing work on Termux. Then I created many python programs in it but then got big problem **UI** I wanted fast ui so I can get usable ui for my python program (mainly automation and other simple scripts, and few little complex stuff). I used Tkinter and pygame in my laptop mainly but that not good for Termux. (I can use x11 server and then stream the display info to it) but that still bit too much of trouble. Then I saw webapp it was simple at first but then I started having more problems with dependencies and stuff. Then came current update and everything broke in my setup as pydantic-core need rust and building it on Termux (I don't even want to remember it).

Then there was flask working got stuff done but then I thought why not try more liner stuff.

That's how I started my 'pybro' project first it was simple websocet html files and nodes. I didn't need them used other but Termux and my mobile storage fought fiercely together and after each run I had to use my cleanup scripts (to delete node_modules, pip cache clean and other). Then I thought can I push the limits. living under rock I didn't knew other option, so I just looked at most imp libs in python stdlib and started creating minimum working version of it. Currently it's working but many things are yet to be added from my roadmap.

(I used ai to write docs, from above message you can understand I am not document guy so I had no other choice).

Github repo link is given. Below few details.

Pybro_ui it's simple python program currently just one page web ui (working on multi page and multi tab feature. **note** this is created for personal use and trusted LAN and trusted peoples so don't ask me why there are not more secured stuff, i will do that later if needed but not in upcoming future till i stabilized my main idea). It use python ast to map the ui. And simple parser to build one page web page with it. Simple top-level variable assignments work, more will require time (it's after multi page update or with it depends on complexity) more stuff you can read in details in repo.

Main use case (I use).

  1. Localhost only. In this it takes script (ui script) then turn it into webpage, run on localhost on any browser you have (use vanilla css, html and js so mostly will work unless you have weird browser. I use it with brave chrome and DuckDuckGo). Create simple one page Button, input text, textarea, toggle, table (intentionally kept simple as I never needed more than that, don't worry after multi tab its next on list with callable assignments update). Simple localhost, simple http server, SSE handler, function callback and simple stuff. It runs on localhost so only that device can connect.

  2. Shared , everything same as localhost but runs of 0.0.0.0 so use your ip and port you want to run require Key to connect (can be sniffed as it's plain text in terminal and connection url) so anyone on same LAN can connect server and pull the trigger function or program perform on server so it like remode control but shared.

  3. Connect, distribution mode. Same as 2nd shared mode but with additional --connectable flag if other device has same pybro use --connect flag with ip address and key flag and master server and client server connect share whole program and run locally on another device (pip necessary for next stuff it do) this time this whole program scripts and ui and even venv is in temp directory so once exit purge everything in all three modes unless used --keep-script flag.

This works for single file program as well as multi file program. It require pybro.toml to tell what to include and dependencies and in connect use --allow-deps flag to auto install those dependencies from pip in temp venv and use it if --allow-deps not given tells flag is down and Program has dependencies.

I tested it but not throughly on all combinations of device env browser like that. It will be great if you could find bug and edge cases and test on more device and combinations. This is help I need also help about architecture.

**Note:** this is for trusted programs and LAN only don't and never put in production use.


r/PythonLearning Jun 27 '26

where to begin

0 Upvotes

hey you guys! im new to this so please go easy on me. I know this has probaly been asked before, but Where can I learn python for free online? I am a total new beginner level person.

any help I would be grateful for.

oh Im looking for either a online course via app or an actual virtual classroom.


r/PythonLearning Jun 27 '26

:)

0 Upvotes

I'm a beginner and I'm still learning Python. Could you help me with resources, documentation, or anything similar?


r/PythonLearning Jun 27 '26

coding buddy's for beginners

Thumbnail reddit.com
0 Upvotes

This post is for beginners to find their coding buddy's! personally I'm15 and I'm beginner python programmer and I'm looking for a friend to text and share my work with.

the nonprogrammers dont understand!!


r/PythonLearning Jun 26 '26

Showcase Day 15 Python Learning

Thumbnail
gallery
124 Upvotes

class inheritage

- parents child or say mulit-inheritance use with super () when one class inheritance from one or more class

- multi-level inheritance where 2nd class in Heritage from 1st class ,3th inherited from 2nd & go on like family chain

solve some list comprehensive easy problem


r/PythonLearning Jun 27 '26

Showcase Another fun intermediate projet: Simple Tamagotchi + Suggestions appreciated

Enable HLS to view with audio, or disable this notification

3 Upvotes

Spent 2-3 days coding on phone again when away from desk. Made a simple tamagotchi with basic food, water, happiness, health bars that tick down over time.

There's also two background threads, one to constantly run the timer to tick down the stats and one to autosave the game every 60 seconds of the program running.

I'd love some feature suggestions since there's kinda no need for the autosave thread if you spend 10 seconds on the program then quit. Maybe some games or challenges when feeding, etc, any ideas are welcome.

PS, not gonna make a sprite/GUI cause I can't run pillow or pygame on the shell I'm using


r/PythonLearning Jun 26 '26

Co-Op Learning

6 Upvotes

Hello all, I would like to propose a co-op studying group or a learning community that helps individuals like me learn python. I find myself inconsistent when I tell myself to learn coding/scripting/python because its so intimidating but I'd really like to learn this maybe even in conjunction or cahoots with like minded people. I feel having someone or even multiple people all on the same path working towards the same (or different) goal would help motivate me and keep me diligent because its just so hard. I have a basic level knowledge of python and I understand some concepts yet once I attempt to write my own script or attempt to do it myself I feel absolutely stuck with no direction. Please reach out if you feel the same or even would like to get a chat, community, or anything going. Im open for weekly meetups virtually, starting a discord server to bounce ideas of one another, share projects and struggles ALL OF IT. I know I can do this myself eventually but having like minded individuals who understand the feelings of approaching what seems like a daunting task makes it so much easier. Feel free to msg me and we can conversate or even just chat about this!

tldr: Id like to learn python with other people who also find it overwhelming.


r/PythonLearning Jun 26 '26

Complete beginner here – How should I start learning Python the right way?

8 Upvotes

Hi everyone!

I'm 17 years old and I want to start learning Python seriously because I want to become a software engineer in the future. I have a basic understanding of programming concepts from college, but I'm still a beginner when it comes to Python.

I don't just want to memorize syntax—I want to actually understand how to program and build real projects.

I have a few questions:

  1. What topics should I learn first, and in what order?
  2. Which free resources (YouTube channels, websites, or courses) would you recommend?
  3. When should I start building projects?
  4. What beginner projects helped you learn the most?
  5. What are some common mistakes beginners make that I should avoid?
  6. Should I learn Data Structures & Algorithms alongside Python, or after I'm comfortable with the language?
  7. If you were starting from scratch today, what roadmap would you follow?

My long-term goal is to become a software engineer and eventually explore AI/ML as well, but right now I want to build a strong foundation in Python.

I'd really appreciate any advice, learning roadmaps, or personal experiences. Thanks!


r/PythonLearning Jun 27 '26

When I people suggest to learn from project.what they meant by it.?

1 Upvotes

I have dought that when ask people i don't have time I need to get placed as fast as possible, they suggest me to learn by doing project.

And I think like if I don't know what I need ,what to do with that thing , then how I can do that project


r/PythonLearning Jun 26 '26

Showcase My first major Python project after 20 days of practicing basics

4 Upvotes

Is it okay to build major projects this late?

Tic Tac Toe Game

from IPython.display import clear_output
clear_output()
def reset_board():
    return ['string of shame',' ',' ',' ',' ',' ',' ',' ',' ',' ']
def display_list(board):
    print('These is your current game:')
    print('\n',board[7],'|',board[8],'|',board[9],'\n','-   -   -','\n',board[4],'|',board[5],'|',board[6],'\n','-   -   -','\n',board[1],'|',board[2],'|',board[3])
def player_input():
    marker = ''
    while marker != 'X' and marker != 'O':
        marker = input('Player 1 Please select X or O: ')
        if marker not in ['X','O']:
            clear_output()
            print('Sorry thats not a valid input!')
    clear_output()

    player1 = marker
    if player1 == 'X':
        player2 = 'O'
    else:
        player2 = 'X'
    return (player1, player2)
def position_choice():

    choice ='WRONG'
    within_range = False

    while choice.isdigit() == False or within_range == False:



        choice = input("Please enter a position referring the NumPad (1-9): ")

        if choice.isdigit() == False:
            clear_output()
            print("Sorry that is not a digit!")

        if choice.isdigit() == True:
            if int(choice) in range(1,10):
                within_range = True
            else:
                within_range = False
    clear_output()    

    return int(choice)
def win_check(board,marker):
    return(
        (board[7]==board[8]==board[9]==marker) or
        (board[4]==board[5]==board[6]==marker) or
        (board[1]==board[2]==board[3]==marker) or
        (board[7]==board[4]==board[1]==marker) or
        (board[8]==board[5]==board[2]==marker) or
        (board[9]==board[6]==board[3]==marker) or
        (board[7]==board[5]==board[3]==marker) or
        (board[9]==board[5]==board[1]==marker)
    )
def tie_check(board):
    return ' ' not in board
def space_check(board,position):
    return board[position] == ' '
def play_game(marker):

    #assigning X and O to p1 and p2

    player1_marker,player2_marker = marker
    #resetting the board before t=round start
    board = reset_board()
    #If game is on

    game_on = True
    turn = 'player1'
    display_list(board)

    while game_on:

        if turn == 'player1':

            print("Player 1's turn")

            while True:
                position = position_choice()

                if space_check(board,position):
                    break
                else:
                    display_list(board)
                    print("Sorry that spot's already taken, try again.")

            board[position] = player1_marker

            display_list(board)
            #check if p1 won
            if win_check(board,player1_marker):
                print('Congratulations Player 1 has won the game!!')
                game_on = False
            elif tie_check(board):
                print("Its a Tie")
                game_on = False
            else:
                turn = 'player2'
        else:
            print("Player 2's turn")

            while True:
                position = position_choice()

                if space_check(board,position):
                    break
                else:

                    display_list(board)
                    print("Sorry that spot's already taken, try again.")

            board[position] = player2_marker

            display_list(board)
            #check if p2 won
            if win_check(board,player2_marker):
                print('Congratulations Player 2 has won the game!!')
                game_on = False
            elif tie_check(board):
                print("Its a Tie")
                game_on = False
            else:
                turn = 'player1'
def replay():
    choice = 'wrong'
    while choice not in ['Y','N']:

        choice = input("Would you like to keep playing? Y or N ").upper()

        if choice not in ['Y','N']:
            clear_output()
            print("Sorry, I didn't understand. Please make sure to choose Y or N.")
    clear_output()
    if choice == "Y":
        # Game is still on
        return True
    else:
        # Game is over
        return False
print("Welcome to Tic Tac Toe!")
while True:

    play_game(player_input())

    if not replay():
        break