CISC 121 Lecture Notes - Lecture 6: Empty String

57 views3 pages
Verified Note

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!")

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents