r/learnpython • • Dec 24 '23

Memorizing syntax

0 Upvotes

Hello, I am new to Python and programming in general. I am learning Python on EdX, and was wondering how important it is to memorize syntax for different functions like find, replace, convert to upper/lower case, etc. Wouldn't memorizing them be redundant since they can be Chatgpted?


r/learnpython • • Jan 01 '26

Project of python

0 Upvotes

Yesterday when I was watching YouTube a video came and its bout beginners project I saw he was making Tik tak toe game I watched it full from start to finish try to understand but I don't understand he used the methods I never saw before like eval etc etc . I feel so demotivated yesterday I thought I know something but everything crashed..


r/learnpython • • Nov 07 '24

How do I compare 2 variables, where one variable contains 5 values?

0 Upvotes

This is basically what it boils down to:

How do I see if variable x is equal to variable y where y contains 5 numbers? (For example 1,2,3,4,5)


r/learnpython • • Dec 10 '20

Python library for detecting hate speech?

0 Upvotes

I’ve been writing a discord bot over the course of this year and a new functionality I want to add is a check for hate speech. I’m currently using better-profanity, but that treats regular profanity and hate speech as the same, which is not ideal, I’d like users to still be able to send profane messages, just not offensive ones. The other library I’ve tried is HateSonar however, if the user attempts to bypass the filter by using numbers, it no longer works. Even in the example code at the link above, it only has a confidence of 60% for a word that is incredibly offensive. My google-fu is failing me and I was hoping you guys may have some suggestions. Thank you!


r/learnpython • • Nov 21 '18

Great Python Courses For Sale on Udemy

0 Upvotes

Hello Everyone,

I don't work for Udemy or anything like that, but I started learning Python a few years ago and kept track of what courses I found most helpful. Right now there's a Black Friday sale over at Udemy ($9.99 per course) and if you're looking for some excellent courses on Python, you can't go wrong with Jose Portilla. The link below is to a search for all of his courses and they are well worth the money.

Link: https://www.udemy.com/courses/search/?src=ukw&q=Jose+Portilla

Again, I'm not affiliated with the site or Jose in any way. I only want to get the word out that these are excellent classes that can be gotten for a steal right now.


r/learnpython • • Feb 27 '25

I just started leaning python

0 Upvotes

So I decided to learn python programming language, I want to develop a software for HR manager. Can you please recommended the best YouTube playlist Thanks in advance


r/learnpython • • Jun 18 '19

Project ideas for people who are looking for them

0 Upvotes

If you are learning programming and have learnt your variables and conditionals and lists and dicts and functions, you might want to do some real-world projects like Google and Facebook and Amazon. Just do them because you can do them. No, you may not do all the things they do, you may not do it the way they do, you may not do it at the huge scale they do, but you can certainly catch the essence of these services. Google is about organising information efficiently. Facebook is about sharing your work and life experiences with your friends and colleagues. Amazon is about listing products for selling online. With a little imagination and determination and help from the internet, you can make it happen. I will give you an example. This is how I will clone Google: 1. Download some Python/your choice of books, tutorials and documentation from the internet. 2. Chop it up into small pieces with each piece labelled with a keyword. 3. Write a command line program to search through the selection for the search term/keyword. 😄 I hope you get the idea.


r/learnpython • • Dec 29 '24

How do I properly learn Python nowadays?

0 Upvotes

I do believe that I have to force myself to get addicted to Python, so I can make progress in my life. I'm generally a very creative person and I think Python is literally the best way to realize the ideas I have in my head. I'm a beginner in Python - I did the cs50 Harvard course, then managed to somehow program something that actually helped me and then I didn't do anything with Python for atleast 8-9 months. I'm now looking to get back into it.

Now, the thing that really bothers me is, I don't really understand how to properly learn Python. I know that I will get stuck many times trying to realize personal projects and when I do, I don't know how to help myself. If I use google for help I feel like I'm not using the fastest way to learn, because optimally I want to find the answer to my question immediatly. When I use AI like ChatGPT it feels like I'm not learning anything, because the AI just tells me everything beforehand and I don't have to think.

Maybe I'm just stupid and finding yet another way to procrastinate, idk... Please help


r/learnpython • • Apr 16 '22

should i learn python ?

0 Upvotes

in 2022 should i have to learn python as a first language in programming please help me to figure out.


r/learnpython • • Jun 26 '24

How do I open or even find a json file?

0 Upvotes

I'm making a text based rpg in python and i learnt that the data can be saved to a json file and then can be read from it and used. But how do I access that json file? Or maybe i should do another method to save game? Also is there a way to open a json file in python so that python can read it's values?


r/learnpython • • Dec 16 '18

How I start?

0 Upvotes

How I start learning python


r/learnpython • • Jun 25 '25

How does the if function knows if i want the True or False statment

0 Upvotes

def main():

x = int(input("What's x? "))

if fun(x): #why not if fun(x) == True: print("is Even")

print("is Even")

else:

print("is not Even")

def fun(n):

if n % 2 == 0:

return True

elif n % 2 != 0:

return False

main()

this work well but why isn't like if fun(x) == True:

print("is Even")

how it does know that i need the True statment


r/learnpython • • Mar 26 '25

Turtle has stopped working, forever

0 Upvotes

im trying to do a simple comand: import turtle

T = turtle.Turtle

T.shape("turtle")

T.colour("blue")

T.pensize(10)

if True:

T.forward(500)

but everytime i do it i get an error saying: [Command: python -u C:\Users\usuario\AppData\Local\Temp\atom_script_tempfiles\2025226-14088-ymfd1j.bd9i8]

Traceback (most recent call last):

File "C:\Users\usuario\AppData\Local\Temp\atom_script_tempfiles\2025226-14088-ymfd1j.bd9i8", line 3, in <module>

T.shape("turtle")

File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\turtle.py", line 2775, in shape

return self.turtle.shapeIndex

^^^^^^^^^^^

AttributeError: 'str' object has no attribute 'turtle'. Did you mean: 'title'?

[Finished in 0.319s]

im using Pulsar (atom 2.0) if it helps

also ive tried doing this in pycharm and VSCode preveously and even uninstalling and reinstalling python


r/learnpython • • Dec 24 '25

i cant find any free intermediate/advanced python courses?? help

0 Upvotes

i feel like ive become stagnant in my growth for coding. i want to learn more intermediate and advanced python. ive been looking for free courses that are intermediate/advanced and cant find any!! help!!!


r/learnpython • • Dec 25 '25

The way to learn python correctly

0 Upvotes

I just started python and I am learning basics for two days.before starting, I was thinking I will finish it by 100 day but now it seems like It may take half a year to start making advanced projects. Day to day it is becoming broad which makes me to make many errors and it takes me too much time to solve this small practices. So which way you recommend me to learn. Is that normal forgetting partial code immediately after I made one practice?

I am learning with video Taught By: Jose Salvatierra From udemy.


r/learnpython • • Jun 09 '25

trying to learn python

1 Upvotes

Hey guys, I'm new to python and coding in general. I'm looking for some advice, good resources and any tips on a good starting projects to do.


r/learnpython • • May 05 '25

Can you get a job at a cybersecurity company with a cybersecurity certificate from a Udemy course?

1 Upvotes

I'm interested in learning cybersecurity on Udemy, but I don't know if the certificate will help me showcase my acquired knowledge. After taking cybersecurity courses, which companies can I apply to with my Udemy certificate, and how can I showcase what I know on my resume? In other words, what cybersecurity projects can I do for my resume/portfolio?


r/learnpython • • May 29 '26

Best software application to learn python offline

1 Upvotes

I want to learn python programming however will not have access to the internet, can anyone recommend a good application (free or not free I don't mind paying) I can download to my laptop and start learning.

Any help greatly appreciated cheers 👍🏻


r/learnpython • • May 05 '24

Can you help me learn python

1 Upvotes

Can someone tell me how they learn python programming. I've been stuck on learning python for a few days now it just won't click in my head. I've watched tutorial and read books and none of them seemed to help


r/learnpython • • Sep 03 '24

What other programming language goes well with Python?

1 Upvotes

Which complementary language is good to know along with Python that is well complemented both technically and from a business and jobs market perspective?

Is it Rust, Go, or older C/C++, or some exotic like Haskell, Elixir, Clojure? I can see that a lot of Python developers lean to Rust for example.

PS: please no SQL, HTML, CSS, markdown, etc querying and declerative languages, we are talking full blown programming languages here.


r/learnpython • • Aug 07 '22

OOP looks like its too hard.. I didn't see any benefit using classes..

0 Upvotes

I think we can use functions to make our code look good.. I'm learning pygame module these days.and I saw lots of experts say you should use OOP. But I did everything with functions not using classes. Just using 650-750 code lines. I don't know maybe I'm fool. please help me guys.what should I do.Not only for pygame....

If classes are good:

I can use them in the future.

else :

I will only use functions.

so this is my code i wrote to my player::

###################################################player#################################################
player_pos = (190,450)
#idle position
idle_1 = pygame.image.load('TRAP\player\\idle\\i1.png').convert_alpha()
idle_2 = pygame.image.load('TRAP\player\\idle\\i2.png').convert_alpha()
idle_3 = pygame.image.load('TRAP\player\\idle\\i2.png').convert_alpha()
idle_4 = pygame.image.load('TRAP\player\\idle\\i1.png').convert_alpha()
player_idle = [idle_1,idle_2,idle_3,idle_4]
player_index = 0
player_1 = player_idle[player_index]
player_rect = idle_1.get_rect(topleft= player_pos, size = (20,38))

def player_idle_anime():
global player_idle,player_index,player_1,player_rect
player_index += 0.1
player_1 = player_idle[int(player_index)]
if player_index >= 3:
player_index = 0
screen.blit(player_1,player_rect)

#player left position
left_1 = pygame.image.load('TRAP\player\left_down\l1.png').convert_alpha()
left_2 = pygame.image.load('TRAP\player\left_down\l2.png').convert_alpha()
left_3 = pygame.image.load('TRAP\player\left_down\l1.png').convert_alpha()
left_4 = pygame.image.load('TRAP\player\left_down\l3.png').convert_alpha()

move_list=[left_1,left_2,left_3]
move_index = 0
def player_move_anime(sprite_list):
global move_index,player_1,player_rect
move_index += 1
player_1 = sprite_list[int(move_index)]
screen.blit(player_1,player_rect)
if move_index>= (len(sprite_list)-1):
move_index = 0
#player right position
right_1 = pygame.image.load('TRAP\player\\right_up\\r1.png').convert_alpha()
right_2 = pygame.image.load('TRAP\player\\right_up\\r2.png').convert_alpha()
right_3 = pygame.image.load('TRAP\player\\right_up\\r1.png').convert_alpha()
right_4 = pygame.image.load('TRAP\player\\right_up\\r3.png').convert_alpha()

right_index = 0
right_list = [right_1,right_2,right_3]

#player up pos
up1 = pygame.image.load('TRAP\player\\right_up\\r1.png').convert_alpha()
up2 = pygame.image.load('TRAP\player\\right_up\\r2.png').convert_alpha()

back_list = [up1,up2,]

#player down pos
down1 = pygame.image.load('TRAP\player\\left_down\\l1.png').convert_alpha()
down2 = pygame.image.load('TRAP\player\\left_down\\l2.png').convert_alpha()

down_list = [down1,down2]
hor_index = 0
def player_hor_move_anime(sprite_list):
global hor_index,player_1,player_rect,g
hor_index += 0.4
player_1 = sprite_list[int(hor_index)]
screen.blit(player_1,player_rect)
if hor_index>= (len(sprite_list)-1):
hor_index = 0
if g == 0:
player_1 = sprite_list[0]

def player_side_idle(player_image):
screen.blit(player_image,player_rect)

#make a rect with x_ps,y_ps, width,height
def make_rect(dimention):
tile = pygame.Rect((dimention))
return tile

#draw the rect you make before
def rect_draw(color,rect_name):
pygame.draw.rect(screen,(color),rect_name)

#make sure are there any collide
def collison(player,object):
coll = []
for tile in object:
if player.colliderect(tile):
coll.append(tile)
return coll

#the full collider machanism
def move(player,object):
global g,v
player.x += v
coll = collison(player,object)
for tile in coll:
if v > 0:
player.right = (tile.left)
if v < 0:
player.left = tile.right
player.y += g
coll = collison(player,object)
for tile in coll:
if g > 0 :
player.bottom = tile.top
if g < 0:
player.top = tile.bottom
return player


r/learnpython • • Mar 27 '22

Why do we use a colon(:) after an if or else statement?

1 Upvotes

I searched the internet and it says it is used to tell python that we are starting a code block and whatever is in the code block will be considered for the if or else statement but shouldn't python just understand that when we write if then we would obviously be writing some conditions in a code block and we already use indentations to define the code block so why do we need the colon? Shouldn't it just be removed?


r/learnpython • • Sep 01 '25

How do I set up Python on VSCode?

1 Upvotes

Hi! I'm currently trying to use Python to create a discord bot to handle my suggestion forums but I keep running into the same problem. When I try to use "import discord" it outputs "ModuleNotFoundError: No module named 'discord'". I've tried to install discord in the terminal but it keeps givi me a bunch of "Requirement already satisfied" messages. How can I fix this?

[SOLVED!!]


r/learnpython • • Sep 12 '24

WTF of the day - why is it so hard to turn an SQLAlchemy object into JSON?

0 Upvotes

Good grief, I want to run a database query for some objects and return the JSON - wtf makes it so hard to do in SQLAlchemy? REST services do this all day long, and it's just modern web development 101.

I guess I'm spoiled by Java?

Look at the answers in this question - https://stackoverflow.com/questions/5022066/how-to-serialize-sqlalchemy-result-to-json

What a fucking mess. I'm following the tutorial and have these data classes and want the simple god damn JSON representation of the result when querying for an Org object (an org with nested owners):

class Org(Base):
    __tablename__ = "org"
    id: Mapped[int] = mapped_column(primary_key=True)
    name: Mapped[str] = mapped_column(String(128))
    admins: Mapped[List["OrgAdmin"]] = relationship(back_populates="org", cascade="all, delete-orphan")

    def __repr__(self):
        return f"{self.id!r}, {self.name!r}, {[admin.email for admin in self.admins]}"

The admins class is similarly simple. I'm following the alchemy "unified tutorial", which explains the database access.

The problem is Flask, starlett/fastapi, and other frameworks make it almost impossible to simply do what 99% of webapps actually do - query the database and return JSON.

What. The. Fuck.

Good luck getting this motherfucker converted to JSON, the database object is returned just like I want but why in the kentucky-fried-fuck can't I just to something like `.json()` to convert it I will never understand:

session.query(Org).options(subqueryload(Org.admins)).filter(Org.id == org_id).first()session.query(Org).options(subqueryload(Org.admins)).filter(Org.id == org_id).first()