You have to create function with argument - ie. offset - and use this value with all x parameters
def snowman(offset):
pygame.draw.circle(ekraan, [255, 250, 250], [400+offset, 200], 60, 0)
pygame.draw.circle(ekraan, [255, 250, 250], [400+offset, 300], 75, 0)
pygame.draw.circle(ekraan, [255, 250, 250], [400+offset, 450], 110, 0)
pygame.draw.circle(ekraan, [0, 0, 0], [380+offset, 175], 12, 0)
pygame.draw.circle(ekraan, [0, 0, 0], [420+offset, 175], 12, 0)
pygame.draw.rect(ekraan, [78, 71, 71], [350+offset, 110, 100, 50], 0)
pygame.draw.rect(ekraan, [78, 71, 71], [330+offset, 155, 140, 5], 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 440], 9, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 480], 9, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 400], 9, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 360], 8, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 320], 8, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 280], 8, 0)
pygame.draw.polygon(ekraan, [255,165,0], [[400+offset, 205], [400+offset, 195],[450+offset, 200]], 0)
pygame.draw.line(ekraan, [139, 69, 19], [450+offset, 300], [505+offset, 260], 8)
pygame.draw.line(ekraan, [139, 69, 19], [500+offset, 190], [500+offset, 550], 3)
pygame.draw.line(ekraan, [255, 250, 250], [498+offset, 190], [480+offset, 138], 2)
pygame.draw.line(ekraan, [255, 250, 250], [498+offset, 190], [485+offset, 138], 2)
pygame.draw.line(ekraan, [255, 250, 250], [498+offset, 190], [490+offset, 138], 2)
pygame.draw.line(ekraan, [255, 250, 250], [500+offset, 190], [495+offset, 140], 2)
pygame.draw.line(ekraan, [255, 250, 250], [500+offset, 190], [500+offset, 140], 2)
pygame.draw.line(ekraan, [255, 250, 250], [500+offset, 190], [505+offset, 140], 2)
pygame.draw.line(ekraan, [255, 250, 250], [502+offset, 190], [510+offset, 142], 2)
pygame.draw.line(ekraan, [255, 250, 250], [502+offset, 190], [515+offset, 142], 2)
pygame.draw.line(ekraan, [255, 250, 250], [502+offset, 190], [520+offset, 142], 2)
And then you can run it with different values
for k in range(-1, 2):
snowman(k*250)
Full working code
# all imports at the top !!!
import pygame
import sys
# --- functions ---
def snowman(offset):
pygame.draw.circle(ekraan, [255, 250, 250], [400+offset, 200], 60, 0)
pygame.draw.circle(ekraan, [255, 250, 250], [400+offset, 300], 75, 0)
pygame.draw.circle(ekraan, [255, 250, 250], [400+offset, 450], 110, 0)
pygame.draw.circle(ekraan, [0, 0, 0], [380+offset, 175], 12, 0)
pygame.draw.circle(ekraan, [0, 0, 0], [420+offset, 175], 12, 0)
pygame.draw.rect(ekraan, [78, 71, 71], [350+offset, 110, 100, 50], 0)
pygame.draw.rect(ekraan, [78, 71, 71], [330+offset, 155, 140, 5], 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 440], 9, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 480], 9, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 400], 9, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 360], 8, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 320], 8, 0)
pygame.draw.circle(ekraan, [0,0,0], [400+offset, 280], 8, 0)
pygame.draw.polygon(ekraan, [255,165,0], [[400+offset, 205], [400+offset, 195],[450+offset, 200]], 0)
pygame.draw.line(ekraan, [139, 69, 19], [450+offset, 300], [505+offset, 260], 8)
pygame.draw.line(ekraan, [139, 69, 19], [500+offset, 190], [500+offset, 550], 3)
pygame.draw.line(ekraan, [255, 250, 250], [498+offset, 190], [480+offset, 138], 2)
pygame.draw.line(ekraan, [255, 250, 250], [498+offset, 190], [485+offset, 138], 2)
pygame.draw.line(ekraan, [255, 250, 250], [498+offset, 190], [490+offset, 138], 2)
pygame.draw.line(ekraan, [255, 250, 250], [500+offset, 190], [495+offset, 140], 2)
pygame.draw.line(ekraan, [255, 250, 250], [500+offset, 190], [500+offset, 140], 2)
pygame.draw.line(ekraan, [255, 250, 250], [500+offset, 190], [505+offset, 140], 2)
pygame.draw.line(ekraan, [255, 250, 250], [502+offset, 190], [510+offset, 142], 2)
pygame.draw.line(ekraan, [255, 250, 250], [502+offset, 190], [515+offset, 142], 2)
pygame.draw.line(ekraan, [255, 250, 250], [502+offset, 190], [520+offset, 142], 2)
# --- main ---
# - init -
pygame.init()
ekraan = pygame.display.set_mode([800, 800])
pygame.display.set_caption("Snowmen")
# - draw -
ekraan.fill([0, 0, 250])
for k in range(-1, 2):
snowman(k*250)
pygame.display.flip()
# - mainloop -
clock = pygame.time.Clock()
running = True
while running:
for i in pygame.event.get():
if i.type == pygame.QUIT:
running = False
clock.tick(5) # slow down to 5 FPS so it will use less CPU power.
# - end -
pygame.quit()

There is also other method.
You create Surface and draw on it and later you blit this surface in three different places.
# all import at the top !!!
import pygame
import sys
# --- functions ---
def create_snowman():
# create surface
image = pygame.Surface((300, 600)).convert_alpha()
# fill with transparent background [x,x,x,0]
image.fill([0, 0, 0, 0])
# draw on surface
pygame.draw.circle(image, [255, 250, 250], [150, 200], 60, 0)
pygame.draw.circle(image, [255, 250, 250], [150, 300], 75, 0)
pygame.draw.circle(image, [255, 250, 250], [150, 450], 110, 0)
pygame.draw.circle(image, [0, 0, 0], [130, 175], 12, 0)
pygame.draw.circle(image, [0, 0, 0], [170, 175], 12, 0)
pygame.draw.rect(image, [78, 71, 71], [100, 110, 100, 50], 0)
pygame.draw.rect(image, [78, 71, 71], [100, 155, 140, 5], 0)
pygame.draw.circle(image, [0,0,0], [150, 440], 9, 0)
pygame.draw.circle(image, [0,0,0], [150, 480], 9, 0)
pygame.draw.circle(image, [0,0,0], [150, 400], 9, 0)
pygame.draw.circle(image, [0,0,0], [150, 360], 8, 0)
pygame.draw.circle(image, [0,0,0], [150, 320], 8, 0)
pygame.draw.circle(image, [0,0,0], [150, 280], 8, 0)
pygame.draw.polygon(image, [255,165,0], [[150, 205], [150, 195],[200, 200]], 0)
pygame.draw.line(image, [139, 69, 19], [200, 300], [255, 260], 8)
pygame.draw.line(image, [139, 69, 19], [250, 190], [250, 550], 3)
pygame.draw.line(image, [255, 250, 250], [248, 190], [230, 138], 2)
pygame.draw.line(image, [255, 250, 250], [248, 190], [235, 138], 2)
pygame.draw.line(image, [255, 250, 250], [248, 190], [240, 138], 2)
pygame.draw.line(image, [255, 250, 250], [250, 190], [245, 140], 2)
pygame.draw.line(image, [255, 250, 250], [250, 190], [250, 140], 2)
pygame.draw.line(image, [255, 250, 250], [250, 190], [255, 140], 2)
pygame.draw.line(image, [255, 250, 250], [252, 190], [260, 142], 2)
pygame.draw.line(image, [255, 250, 250], [252, 190], [265, 142], 2)
pygame.draw.line(image, [255, 250, 250], [252, 190], [270, 142], 2)
return image
# --- main ---
# - init -
pygame.init()
ekraan = pygame.display.set_mode([800, 800])
pygame.display.set_caption("Snowmen")
# - draw -
# get image and rect
snowman_image = create_snowman()
snowman_rect = snowman_image.get_rect()
ekraan.fill([0, 0, 250])
# blit image on screen
for k in range(0, 3):
snowman_rect.x = k*250
ekraan.blit(snowman_image, snowman_rect)
pygame.display.flip()
# - mainloop -
clock = pygame.time.Clock()
running = True
while running:
for i in pygame.event.get():
if i.type == pygame.QUIT:
running = False
clock.tick(5) # slow down to 5 FPS so it will use less CPU power.
# - end -
pygame.quit()
def snowman(x):, then you'll have thek*40value from the while loop (btwkis not defined anywhere) available inside the function and can add it to the x-positions.