Skip to content
MathsGenie logo
Open app

Course home

  1. GCSE
  2. Computer Science AQA
  3. Question bank

Programming concepts

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637
Question 34

A software engineer is writing a Python program to monitor a drone's ascent. The drone climbs in vertical stages of 5 meters at a time. The program is designed to log and display each stage's altitude (starting at 5 meters) up to and including a maximum altitude ceiling entered by the user.

Drone ascent illustration

The engineer writes the following code:

altitude = 5
limit = int(input("Enter the maximum altitude ceiling: "))
while altitude != limit:
    print(altitude)
    altitude = altitude + 5
print("Ascent complete!")

Using Python only, change the program code inside the while loop so that it will work and terminate correctly for any positive integer limit entered by the user.

[4]

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts