Python Flashcards
+
Addition
-
Subtraction
*
Multiplication
/
Division (standard); floating-point numbers
//
Division (integer); no decimals; rounds to whole num
**
Exponents
“Hi” + “ world!”
Text in quotes added together
“Hi” * 5
Concatenates copies of the string
[1,2] + [3,4]
Concatenates the lists into one list
Python is 0-indexed, so [1] is list item 0
not True
Negation
True or False
One OR the other must be True statements
True and False
Both must be true to be true
==
Equals to
!=
Not equal to
<
Less than
>
Greater than
<=
Less than or equal to
> =
Greater than or equal to
And
Both conditions must be true
Or
One condition must be true
if statements
conditional statement with the options if, else, elif
elif
elif (else if) = multiple conditions with different responses
name = “Averil”
if name == “Averil”:
response = “Hi Averil!”
else:
response = “Girl bye.”
Hi Averil!
name = “Averil”
if name == “Averil”:
response = “Hi Averil!”
elif name = “Ava”:
response = “Hi Ava”
else:
response = “Girl bye.”
Hi Averil!