Q:

PyGame - Rendering shapes

I am coding a game called the pie game from a book called 'More Python Programming for the Absolute Beginner' but the shapes don't render and a black screen appears.
I want it to display 4 numbers and when you press the keys 1, 2, 3 and 4 on the keyboard, slices of pie/pizza/circular bread/whatever appear (1 arc and 2 lines).
I can't see a problem with the code.
# The PieGame
#
# The last game for C02. Press keys 1, 2, 3 and 4 and the
# pie pieces will change colour! :)
#
# The PieGame was programmed in PyGame
#
# Copyright by wait, who cares, this is just a really boring game
#
# -----------------------------------------------------------------

import pygame, sys, math, random
from pygame.locals import *

# +---+ SETUP +---+

pygame.init()

SURFACE = pygame.display.set_mode((600, 500))
pygame.display.set_caption("The PieGame - Press keys 1, 2, 3, 4")

FONT = pygame.font.Font(None, 60)

# +---+ SETUP 2 +---+

BLACK  = 0, 0, 0
SILVER = 200, 200, 200

RED    = 220, 0, 0
YELLOW = 0, 220, 220
GREEN  = 0, 220, 0
BLUE   = 0, 0, 220
PINK   = 220, 220, 0

COLOUR = SILVER

WIDTH = 4
X = 300
Y = 250
RADIUS = 200
POSITION = X-RADIUS, Y-RADIUS, RADIUS*2, RADIUS*2

piece1 = False # state based programming
piece2 = False
piece3 = False
piece4 = False

# +---+ LOOP +---+

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            sys.exit()
        elif event.type == KEYUP:
            if event.key == K_ESCAPE:
                sys.exit()

            elif event.key == pygame.K_1:
                piece1 = True
            elif event.key == pygame.K_2:
                piece1 = True
            elif event.key == pygame.K_3:
                piece1 = True
            elif event.key == pygame.K_4:
                piece1 = True

    pygame.display.update()

# +---+ MAIN CODE +---+

SURFACE.fill(BLACK)

# draw numbers inside pie slices
TEXT1 = FONT.render("1", True, COLOUR)
screen.blit(TEXT1, (X+RADIUS/2-20, Y-RADIUS/2))

TEXT2 = FONT.render("2", True, COLOUR)
screen.blit(TEXT2, (X+RADIUS/2, Y-RADIUS/2))

TEXT3 = FONT.render("3", True, COLOUR)
screen.blit(TEXT3, (X+RADIUS/2, Y-RADIUS/2-20))

TEXT4 = FONT.render("1", True, COLOUR)
screen.blit(TEXT4, (X+RADIUS/2-20, Y-RADIUS/2-20))

# if piece state flag is true, draw the piece
if piece1:
    start_angle = math.radians(0)
    end_angle = math.radians(90)
    pygame.draw.arc(SURFACE, COLOUR, POSITION, start_angle, end_angle, WIDTH)
    pygame.draw.line(SURFACE, COLOUR, (X, Y), (X,Y-RADIUS), width)
    pygame.draw.line(SURFACE, COLOUR, (X, Y), (X+RADIUS,Y), width)

if piece2:
    start_angle = math.radians(90)
    end_angle = math.radians(180)
    pygame.draw.arc(SURFACE, COLOUR, POSITION, start_angle, end_angle, WIDTH)
    pygame.draw.line(SURFACE, COLOUR, (X, Y), (X,Y-RADIUS), width)
    pygame.draw.line(SURFACE, COLOUR, (X, Y), (X-RADIUS,Y), width)

if piece3:
    start_angle = math.radians(180)
    end_angle = math.radians(270)
    pygame.draw.arc(SURFACE, COLOUR, POSITION, start_angle, end_angle, WIDTH)
    pygame.draw.line(SURFACE, COLOUR, (X, Y), (X-RADIUS,Y), width)
    pygame.draw.line(SURFACE, COLOUR, (X, Y), (X,Y+RADIUS), width)

if piece4:
    start_angle = math.radians(270)
    end_angle = math.radians(360)
    pygame.draw.arc(SURFACE, COLOUR, POSITION, start_angle, end_angle, WIDTH)
    pygame.draw.line(SURFACE, COLOUR, (X, Y), (X,Y+RADIUS), width)
    pygame.draw.line(SURFACE, COLOUR, (X, Y), (X+RADIUS,Y), width)

# detect if the pie is finished
if piece1 and piece2 and piece3 and piece4:
    new_colour = random.randint(1,5)
    if new_colour == 1:
        COLOUR = RED
    elif new_colour == 2:
        COLOUR = YELLOW
    elif new_colour == 3:
        COLOUR = GREEN
    elif new_colour == 4:
        COLOUR = BLUE
    elif new_colour == 5:
        COLOUR = PURPLE

pygame.display.update()

A:

Firstly, the reason the key-presses are not having an effect is because the code that draws the arcs is not in the main loop. It must be indented by one tab space; however, this results in two: 
pygame.display.update() 

function calls. You must remove the first one as it should be found at the end of the main loop.
Secondly, you do not have a surface called screen to blit the text onto. Here you must use the SURAFCE variable.
These edits make the program run, however it may not have the functionality you want. Here is a link to the updated code that works: http://pastebin.com/GFfP2hX4

