CheatSheet Python 1 Keywords1
CheatSheet Python 1 Keywords1
False, True Data values from the data type Boolean False == (1 > 2), True == (2 > 1)
if, elif, else Conditional program execution: program starts with x = int(input("your value: "))
“if” branch, tries the “elif” branches, and finishes with if x > 3: print("Big")
“else” branch (until one branch evaluates to True). elif x == 3: print("Medium")
else: print("Small")
in Checks whether element is in sequence 42 in [2, 39, 42] # True
return Terminates execution of the function and passes the def incrementor(x):
flow of execution to the caller. An optional value after return x + 1
the return keyword specifies the function result. incrementor(4) # returns 5