Computer Science 1026A/B Lecture 3: CompSci 1026-Chapter 3 Notes
terubarenuka and 39895 others unlocked
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents
Document Summary
A computer program often needs to make decisions based on input, or circumstances. For example, buildings often skip" the 13th floor, and elevators should too: the 14th floor is really the 13th floor. So every floor above 12 is really floor - 1". If floor > 12, actual floor = floor - 1: the two keywords of the if statement are: if else. Some constructs in python are compound statements. compound statements span multiple lines and consist of a header and a statement block. The if statement is an example of a compound statement. If you use pycharm; pycharm properly indents the statement block. at the end of the block enter a blank line and it will shift back to the first column in the current block. Statement blocks can be nested inside other types of blocks (we will learn about more blocks later) Statement blocks signal that one or more statements are part of a given compound statement.