Home of real teaching & learning
  • Full support for teachers
  • Focus on critical thinking
  • Engaging classroom activities
  • Integrated student eBook
  • Assessed tasks / qBank
  • Practice exam questions

The InThinking Guarantee: Our sites are written by expert practitioners and not by AI

See our AI policy

Disclaimer: InThinking subject sites are neither endorsed by nor connected with the International Baccalaureate Organisation.

Don't miss out, find out!

B2.2 Broken Code challenges - Python

B2.2.2: Arrays & Lists (Bounds & access)# Topic B2.2.2: Arrays & Lists # CHALLENGE: This code tries to shift every number to the left. # (e.g., [10, 20, 30] becomes [20, 30, 10]) # But it crashes with an "IndexError: list index out of range". # Why does the loop go too far? data = [10, 20, 30, 40, 50] n = len(data) # We want to move data[1] to data[0], data[2] to data[1], etc. # BUG IS HERE: Look at the range. for i...

Help