You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Programs interact with the user through input (receiving data) and output (displaying data). This lesson covers how to read data from a user, display results, and format output — all essential skills for GCSE Computer Science (AQA 3.2 / OCR J277 2.2).
Output is how a program communicates results to the user, typically by displaying text on the screen.
OUTPUT "Hello, World!"
OUTPUT "Your score is: ", score
print("Hello, World!")
print("Your score is:", score)
You can output multiple items by separating them with commas. Python adds a space between items automatically.
You can join (concatenate) strings to build a message:
name = "Alice"
print("Welcome, " + name + "!")
# Output: Welcome, Alice!
When concatenating, all parts must be strings. Use str() to convert numbers:
score = 85
print("Your score is " + str(score))
Alternatively, use f-strings (formatted string literals) in Python 3.6+:
print(f"Your score is {score}")
Input is how a program receives data from the user, typically via the keyboard.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.