Scroll to see replies
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
updateDisplay(words):
# set a counter to know what line we are currently writing to
currentLine = 0
# loop through the following code while the queue of words is not empty
while words is not empty then
# get the next word in the queue, removing it from the queue
word = words.remove()
# check how many spaces the current line has left
lineCharsLeft = 20 - len(display[currentLine])
# if the line does not have enough space to print the word move onto the next line
if lineCharsLeft <= len(word) then
currentLine += 1
endif
# add the current word onto the end of the current line
display[currentLine] += word
# check how many spaces the current line has left
lineCharsLeft = 20 - len(display[currentLine])
# if the current line has spaces left, add a space to separate words
if lineCharsLeft > 0 then
display[currentLine] += " "
endif
endwhile
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Last reply 15 minutes ago
JK Rowling in ‘arrest me’ challenge over hate crime lawLast reply 16 minutes ago
Official University of Edinburgh Applicant Thread for 2024Last reply 1 week ago
OCR A-level Computer Science Paper 2 (H446/02) - 19th June 2023 [Exam Chat]Last reply 2 weeks ago
AQA A-level Computer Science Paper 1 (7517 1A - 1E) - 12th June 2023 [Exam Chat]Last reply 4 weeks ago
OCR A-level Computer Science Paper 1 (H446/01) - 12th June 2023 [Exam Chat]Last reply 2 months ago
OCR GCSE Computer Science Paper 1 (J277/01) - 19th May 2023 [Exam Chat]Last reply 3 months ago
AQA GCSE Computer Science Paper 2 (8525/2) - 25th May 2023 [Exam Chat]Last reply 5 months ago
AQA GCSE Computer Science Paper 1 (8525/1A, 1B, 1C) - 19th May 2023 [Exam Chat]Last reply 5 months ago
AQA Computer Science NEA and Computer science paper 1 questionLast reply 1 week ago
OCR A-level Computer Science Paper 2 (H446/02) - 19th June 2023 [Exam Chat]Last reply 2 weeks ago
AQA A-level Computer Science Paper 1 (7517 1A - 1E) - 12th June 2023 [Exam Chat]Last reply 4 weeks ago
OCR A-level Computer Science Paper 1 (H446/01) - 12th June 2023 [Exam Chat]Last reply 2 months ago
OCR GCSE Computer Science Paper 1 (J277/01) - 19th May 2023 [Exam Chat]Last reply 3 months ago
AQA GCSE Computer Science Paper 2 (8525/2) - 25th May 2023 [Exam Chat]Last reply 5 months ago
AQA GCSE Computer Science Paper 1 (8525/1A, 1B, 1C) - 19th May 2023 [Exam Chat]Last reply 5 months ago
AQA Computer Science NEA and Computer science paper 1 question