2.2 Data Types Flashcards

1
Q

Data types

A

When programming, variables should be given appropiate data types

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

What are the different data types

A

. Character
. String
. Integer
. Real
. Boolean

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

Character

A

A single character such as a letter, number or punctuation symbol
Examples:
T
8
?

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

String

A

A sequence of characters, including letters, numbers and punctuation
Examples:
Harry Waters
14:50pm
Ice Age 4

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

Integer

A

A whole number

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

Real

A

A decimal number

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

Boolean

A

An answer that only has two possible values
Examples:
. True / False
. Yes / No
. 0 / 1

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

Casting

A

Converting the value of a variable from one data type into another

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

Python casting

A

Python automatically assumes an input is a string so the int() command is used to cast an input into an integer.
Other Python casting commands include str() and float()

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