Class07 Python II
Class07 Python II
SIJ1004
Introduction to Computational Biology
Control structures
• Computer programs = sequences of instructions (followed one after the other).
1
4/4/2023
1. if statement
• Allow the program to respond to input from user.
• A condition:
• True or false
• Value
2
4/4/2023
2. if … else statement
• Alternative execution.
• Two possibilities determined by the
conditions
• Allow the program to respond to
input from user.
• A condition:
• True or false
• Value
3
4/4/2023
4. Nested if statement
• We can write an entire “if … else” statement in another “if … else” statement.
Example:
4
4/4/2023
5
4/4/2023