w1 Flashcards

(19 cards)

1
Q

What the difference between ‘==’ and ‘=’

A

’==’ checks whether left-side is equal to right side
‘=’ assigns value (right-side) to variable (left side)

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

what does += do in the example x += y

A

takes the current value of x, adds y to it, and stores the result back in x.

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

% meaning

A

remainder

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

/ meaning

A

true division

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

what is answer of true division

A

a float

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

what are intergers

A

whole numbers

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

what are floats

A

numbers with decimal points

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

what are complex numbers

A

real and imaginary numbers

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

what are strings

A

combination of any characters

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

what is boolean

A

true or false

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

what are variables

A

they can hold values within programs

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

how I figure out what type a value is

A

by using the type() function

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

how are values assigned to variables

A

through the ‘=’ operator

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

take round(12.3)
what is the function and argument

A

function is round()
arg is 12.3

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

what does the round function even do

A

rounds the float value of x to the nearest int

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

what type of data does true division always return

17
Q

what is the pass function

A

a no operation statement used when something in synoptically required

18
Q

what type of error is an exception

A

run-time error

19
Q

what does boolean consider false

A

the number 0 or any empty string, list, tuple etc