data sets Flashcards

1
Q

Text Type:

A

str

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

Numeric types

A

int, float, complex

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

Sequence Types:

A

list, tuple, range

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

Mapping Type:

A

dict

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

Set Types:

A

set, frozenset

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

Boolean Type:

A

bool

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

Binary Types:

A

bytes, bytearray, memoryview

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

None Type:

A

NoneType

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

Numeric Types:

A

int, float, complex

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

Sequence Types:

A

list, tuple, range

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

Mapping Type:

A

dict

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

Set Types:

A

set, frozenset

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

Boolean Type:

A

bool

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

Binary Types:

A

bytes, bytearray, memoryview

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

None Type:

A

NoneType

17
Q

You can get the data type of any object by using the?

A

type()

x = 5
print(type(x))

18
Q

A whole number, positve or negative

A

int

19
Q

is a number, positive or negative, containing one or more decimals, can also be scientific numbers with an “e” to indicate the power of 10

A

float

x = 1.10
y = 1.0
z = -35.59

print(type(x))
print(type(y))
print(type(z))

x = 35e3
y = 12E4
z = -87.7e100

print(type(x))
print(type(y))
print(type(z))

20
Q

numbers are written with a “j” as the imaginary part:

A

x = 3+5j
y = 5j
z = -5j

print(type(x))
print(type(y))
print(type(z))

21
Q

How can you convert one type to another with the int(), float(), and complex() methods:

A

convert from int to float:

x = 1 # int
y = 2.8 # float
z = 1j # complex

a = float(x)

b = int(y)

c = complex(x)

print(a)
print(b)
print(c)

print(type(a))
print(type(b))
print(type(c))

22
Q

but Python has a built-in module called ? that can be used to make auto output numbers:

A

random()
“”””
import random

print(random.randrange(1, 10))
“””