CISC 121 Lecture Notes - Lecture 6: Empty String
CISC 121 verified notes
6/38View all
Document Summary
Programming languages should give the programmer a way to specify that an action should take place in certain circumstances, when specific conditions are met, but not others. In many languages, consistent code block indentation is good style. In python 3, it"s correct syntax/part of the language definition. Python 3 uses the if statement, which evaluates an expression of type bool. If that expression is evaluated to true, it proceeds to execute a block/collection of one+ program statements. Example name = input( what is your name? if name[0] == r": print( wow!") print( we have the same first initial!") An adjunct to the if statement is the else clause, which causes an alternate block to execute instead (if the if evaluates to. Example print( we have the same name!") print( wow!") name = input( what is your name? if name == richard": else: print( we don\"t have the same name!") print( boo!")