Day three - Control flow/Logical Operators Flashcards
What is the command to establish a condition?
Use if
How to end an if condition?
Use else
What does it mean when we have only 1 ‘=’ sign?
That it is an assignment for the element after it (variable).
What does it mean when we have 2 ‘==’ signs?
It means that we are checking equality (if that exists/its true)
What does the ‘elif’ do?
It applies the nested condition, which is an if inside an if for infinite times.
It also allows you to create several conditions (also inside others).
What is an accumulator?
How to make one?
It’s a variable which will calculate counts and others values inside an if, elif and so on.
a = 0
a = 1
a += b
What are the logical operators?
and / or / not
What does the logical operator ‘not’ do?
Reverses the condition.
a = 12
not a > 15
True
How to make the computer ignore a symbol (and treat it as a text)?
Use \ before the symbol.
print(‘‘You're’’)