Python Basics
Loops & Logic
Game development
Error
100

What function is used to display something on the screen?

print()

100

for i in range(4):

    print(i)

0 1 2 3 

100

What is a collision in a game?

When two game objects detect that they have touched or overlapped.

100

name = input("Name: ")


if name = "Alex":

    print("Hello Alex")

= should be ==

200

What data type is "Hello"?

String (str)

200

score = 0


for i in range(5):

    score += 2


print(score)

10

200

What is an NPC?

Non-Player Character — a character controlled by the game rather than the player.

200

score = 0


if score > 100:

print("You win!")


else:

print("Keep playing!")

print needs to be indented

300

What symbol is used to assign a value to a variable?

=

300

What keyword can immediately stop a loop?

break

300

What is a Game Loop and what are its core phases?

The game loop is the central mechanism that runs continuously during gameplay to process data and render frames. Its three primary phases are Input Processing (capturing keyboard, mouse, or controller actions), Game Logic Update (calculating physics, AI behavior, and state changes), and Rendering (drawing the updated scene onto the screen). [1]

400

x = 5 

y = 3 

print(x + y * 2)

Output 

11

400

Find the problem

x = 0


while x < 5:

    print(x)

x is never increased, creating an infinite loop.

400

numbers = [1, 2, 3]


for i in range(4):

    print(numbers[i])

The loop attempts to access numbers[3], which doesn't exist.

500

name = "Python"

print(name[2])

t