Data Types Flashcards
1
Q
Integer
A
Used to store whole numbers e.g age or house number
2
Q
Real/Float
A
Numbers with a decimal place e.g money (£2.45)
3
Q
Boolean
A
TRUE/FALSE values (e.g 18+ in a voting program)
4
Q
Character
A
Stores a single character e.g storing the input for a menu within a program (option A, B, C or D)
5
Q
String
A
Used to store alphanumeric characters e.g the word “Programming”. Other examples include names or DOB with / to separate values
6
Q
Casting
A
The process of changing a variable’s data type within a program.
7
Q
Example of Casting -
A
- age_integer = int(input(“Please enter your age - “))
- print(age_integer + 5)
- age_string = str(age_integer)
- print(age_string + “5”)