Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
Question 45

Write a Python program to check if a logistics system has processed a consecutive streak of six package sequence numbers within 120 recorded scans.

When writing your program you should assume:

  • there is an array called scans that contains the recorded package sequence numbers of the 120 scans
  • scans[0] will contain the value of the first scan and scans[119] will contain the value of the last scan
  • the values in scans are unique integers and already stored in ascending numerical order
  • there is a Boolean variable called isConsecutiveRun that has an initial value of False.

Your program should set isConsecutiveRun to True if there is a consecutive streak of six sequence numbers (a run of 6 consecutive integers, such as 101, 102, 103, 104, 105, 106).

You should use indentation as appropriate, meaningful variable name(s), and Python syntax in your answer.

[6]
Markscheme

Programming concepts Questions

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

298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank