Day three - Control flow/Logical Operators Flashcards

1
Q

What is the command to establish a condition?

A

Use if

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to end an if condition?

A

Use else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does it mean when we have only 1 ‘=’ sign?

A

That it is an assignment for the element after it (variable).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does it mean when we have 2 ‘==’ signs?

A

It means that we are checking equality (if that exists/its true)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the ‘elif’ do?

A

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).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an accumulator?

How to make one?

A

It’s a variable which will calculate counts and others values inside an if, elif and so on.
a = 0
a = 1
a += b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the logical operators?

A

and / or / not

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the logical operator ‘not’ do?

A

Reverses the condition.
a = 12
not a > 15
True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to make the computer ignore a symbol (and treat it as a text)?

A

Use \ before the symbol.

print(‘‘You're’’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly