I'm new to programming. This is my first project where I tried to use object-oriented programming. I'm looking for all kinds of comments.import pygame, sysfrom pygame.locals import *from random import choice, randomINDIAN_RED = (205, 92, 92)DARK_SALMON = (233, 150, 122)DIM_GRAY = (105, 105, 105)BLACK = (0, 0, 0)SCREEN_HEIGHT = 300SCREEN_WIDTH = 400DISPLAYSURF = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), 0)PADDLE_HEIGHT = 50PADDLE_WIDTH = 4PADDLE_VEL = 7# enum valuesUP = goraDOWN = dolpoints_r = 0points_l = 0class Paddle:    def __init__(self, x, y, clr, vel):        self.x = x        self.y = y        self.height = PADDLE_HEIGHT        self.width = PADDLE_WIDTH        self.color = clr        self.vel = vel        self.is_moving = False        self.direction = None    def draw(self):        leftx = self.x - self.width/2        topy = self.y - self.height/2        coords = pygame.Rect(leftx, topy, self.width, self.height)        pygame.draw.rect(DISPLAYSURF, self.color, coords, 0)    def move(self):        if not self.is_moving:            return        if self.direction == UP and self.y - self.height/2 > 0:            self.y -= self.vel         elif self.direction == DOWN and self.y + self.height/2 < SCREEN_HEIGHT:            self.y += self.vel class Ball:    def __init__(self, r, color, vel):        self.r = r        self.color = color        self.vel = vel        self.reset()    def draw(self):        radius = self.r        pygame.draw.circle(DISPLAYSURF, self.color, (self.x, self.y), self.r)    def move(self):        self.x += self.velx        self.y += self.vely        if self.y - self.r < 0 or self.y  + self.r > SCREEN_HEIGHT:            self.vely = - self.vely        if self.x - self.r < 0:            if collide(paddle_l, self):                self.velx = - self.velx            else:                self.reset()                global points_r                points_r += 1        elif self.x + self.r > SCREEN_WIDTH:            if collide(paddle_r, self):                self.velx = - self.velx            else:                self.reset()                global points_l                points_l += 1    def reset(self):        self.velx = choice(range(self.vel//2, self.vel))        self.vely = choice(range(self.vel//2, self.vel))        if random() > 0.5:            self.velx *= -1        if random() > 0.5:            self.vely *= -1        self.x = SCREEN_WIDTH//2        self.y = SCREEN_HEIGHT//2def collide(paddle, ball):    if abs(ball.y - paddle.y) < paddle.height/2 + ball.r:        return True    else:        return Falsedef create_points_text():    text = FONT.render(str(points_l) +  :  + str(points_r), 1, (0,0,0))    textpos = text.get_rect()    textpos.centerx = SCREEN_WIDTH/2    textpos.centery = 15    return (text, textpos)pygame.init()FPS = 30fpsClock = pygame.time.Clock()pygame.display.set_caption(Ping Pong IGF 2017)FONT = pygame.font.Font(None, 30)paddle_r = Paddle(SCREEN_WIDTH - PADDLE_WIDTH/2, SCREEN_HEIGHT/2, INDIAN_RED, PADDLE_VEL) #right paddlepaddle_l = Paddle(0 + PADDLE_WIDTH/2, SCREEN_HEIGHT/2, DARK_SALMON, PADDLE_VEL) #left paddleball = Ball(5, BLACK, 6)while True: #main loop    DISPLAYSURF.fill(DIM_GRAY)    paddle_r.move()    paddle_l.move()    paddle_r.draw()    paddle_l.draw()    ball.draw()    ball.move()    text_to_draw, textpos_to_draw = create_points_text()    DISPLAYSURF.blit(text_to_draw, textpos_to_draw)    for event in pygame.event.get():        if event.type == pygame.KEYDOWN:            if event.key == pygame.K_UP:                paddle_r.is_moving = True                paddle_r.direction = UP            elif event.key == pygame.K_DOWN:                paddle_r.is_moving = True                paddle_r.direction = DOWN            if event.key == pygame.K_w:                paddle_l.is_moving = True                paddle_l.direction = UP            elif event.key == pygame.K_s:                paddle_l.is_moving = True                paddle_l.direction = DOWN        elif event.type == pygame.KEYUP:            if event.key == pygame.K_UP:                paddle_r.is_moving = False            elif event.key == pygame.K_DOWN:                paddle_r.is_moving = False            if event.key == pygame.K_w:                paddle_l.is_moving = False            elif event.key == pygame.K_s:                paddle_l.is_moving = False        elif event.type == QUIT:            pygame.quit()            sys.exit()    pygame.display.update()    fpsClock.tick(FPS)
Pong in Python and Pygame
python;beginner;game;pygame
Generally looks pretty good.  A few things stick out:if abs(ball.y - paddle.y) < paddle.height/2 + ball.r:    return Trueelse:    return Falseis clearer as just:return abs(ball.y-paddle.y) < paddle.height/2 + ball.rAlso, lots of repetition is a code smell, and    if event.type == pygame.KEYDOWN:        if event.key == pygame.K_UP:            paddle_r.is_moving = True            paddle_r.direction = UP        elif event.key == pygame.K_DOWN:            paddle_r.is_moving = True            paddle_r.direction = DOWN        if event.key == pygame.K_w:            paddle_l.is_moving = True            paddle_l.direction = UP        elif event.key == pygame.K_s:            paddle_l.is_moving = True            paddle_l.direction = DOWNis the same as:MOVEKEYS = { pygame.K_UP  : (paddle_r, UP),              pygame.K_w   : (paddle_l, UP),             pygame.K_DOWN: (paddle_r, DOWN),             pygame.K_s   : (paddle_l, DOWN) }if event.type == pygame.KEYDOWN and event.key in MOVEKEYS:    paddle, direction = MOVEKEYS[event.key]    paddle.is_moving = True    paddle.direction = directionNote: fewer if statements and a lot less repetition. It makes the KEY_UP block easier too:elif event.type == pygame.KEYUP and event.key in MOVEKEYS:    paddle, _ = MOVEKEYS[event.key]    paddle.is_moving = False