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.5 Broken Code challenges - Python

B2.5.1a: File Modes (Read vs. Write vs. Append)# Topic B2.5.1: File Modes # CHALLENGE: We want to add a new student to our 'students.txt' log. # But every time we run this, the previous names disappear! # Why is the file being overwritten instead of updated? new_student = "Alex" # BUG IS HERE file = open("students.txt", "w") file.write(new_student + "\n") file.close() print("Student added.")B2.5.1b: Reading from...

Help