Selection Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is selection?

A

Making choices in the flow of execution of a program made on the basis of expressions that must evaluate to true or false(Boolean)

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

Example:

If :

else:

A

Just an example ;)

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

What are the Boolean operators?

A

And or Not

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

Operator precedence

A

() = highest
**
* / // %
< <= >= > == !=
Not
And
Or = lowest

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

De Morgan’s laws

A

Not (A or B) = Not A and Not B
Not (A and B) = Not A or Bot B

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

What is a+= 3?

A

A = a + 3

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

What does the eval function do?

A

Convert string into number

I.e eval(input(…..))

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

How to: — Truncate the floating point number
— Round a number up
— Round a number down
— Round to the closest integer or floating point?
— Square Root

A
  • int(x)
  • math.ciel(x)
  • math.floor(x)
  • round(x, decimal places)
  • math.sqrt(x)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly