Chapter 10 Introduction to Sequence Control Structures

10.1 What is the Sequence Control Structure?

Sequence control structure refers to the line-by-line execution by which statements are executed sequentially, in the same order in which they appear in the program, without skipping any of them. They might, for example, carry out a series of read or write operations, arithmetic operations, or assignments to variables.

The following program shows an example of Python statements that are executed sequentially.

 file_10.1
#Prompt the user to enter value for num
num = int(input("Enter a number: "))
 
#Calculate the square of num
result = num ** 2

Get Python and Algorithmic Thinking for the Complete Beginner now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.