Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Develop code

EasyMediumHard
12345678910111213141516171819202122232425262728
Question 6

A programmer has written a Python program to calculate how many full 6-pack egg boxes can be filled from a collection of 57 eggs, and how many individual eggs will be left over.

There are three errors in the code.

total_eggs = 57
box_size = 6

# Calculate how many full boxes can be filled
full_boxes = total_eggs / box_size

# Calculate leftover eggs
left_over = total_eggs // box_size

# Output the results
print("Full boxes: " + str(full_boxes))
print("Leftover eggs: " + str(leftover))

Amend the code to correct the three errors.

[3]

Develop code Questions

  1. IGCSE
  2. /Computer Science
  3. /Develop code