2.2.2 Data types Flashcards

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

What is casting? [1]

A

Converting one data type to another [1]

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

What is the python command to cast to a string? [1]

A

str() [1]

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

What is the python command to cast to an integer? [1]

A

int() [1]

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

What is the Python command to cast an ASCII number to its matching character? [1]

A

chr() [1]

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

What is the Python command to cast a character to it’s matching ASCII number? [1]

A

ord() [1]

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

What is an integer?

A

A whole number e.g. 2

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

What is a character

A

A single letter, number or symbol e.g. A

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

What is a string

A

A sequence of characters, e.g. Hello

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

What is a real number

A

A number with a decimal e.g. 2.2

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

What are real numbers also known as?

A

floats / floating point numbers

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

What is a Boolean

A

True or False

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

What data type would be best suited to store a phone number?

A

String - if you use int you’ll lost the 0 at the start.

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

What data type would be best suited to store the time in a 100m race?

A

Real number - you need the detail from the decimal

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