4.1.1
Data Types
Data Types
Data Types
Every piece of data that is stored has a type. The type determines how it is stored and what you can do with the data.


Integer
Integer
- Whole numbers.
- Examples:
- 12, 0, -142.


Float / Real
Float / Real
- Fractional numbers.
- Examples:
- 0.42, 1.00.


String
String
- Text data.
- Example:
- "Hello, world!".


Character
Character
- A single letter of text data.
- Example:
- 'a'.


Boolean
Boolean
- A True or False value.
- Examples:
- True.
- False.
Casting
Casting
Casting is the process of converting data from one type to another.


Reasons for casting
Reasons for casting
- One of the most common reasons for casting is output.
- Output must be formatted as a string, and so we may need to convert a certain piece of data to a string.
- All input also comes as a string, and must then be converted to other data types.


Casting functions
Casting functions
- Casting to a string can be done using the str function. E.g:
- str(3) gives "3".
- Casting to an integer can be done using the int function. E.g:
- int(3.4) gives 3.
- Casting to a float can be done using the float function. E.g:
- float("3.4") gives 3.4.
1Components of a Computer
1.1Structure & Function of the Processor
1.2Types of Processors
2Software & Software Development
2.1Systems Software
2.2Applications Generation
2.3Software Development
3Exchanging Data
3.1Compression, Encryption & Hashing
3.3Networks
4Data Types, Data Structures & Algorithms
4.1Data Types
5Legal, Moral, Cultural & Ethical Issues
5.1Computing Related Legislation
6Elements of Computational Thinking
6.1Thinking Abstractly
6.2Thinking Procedurally
6.3Thinking Logically
7Problem Solving & Programming
7.1Programming Techniques
7.2Programming Construction
Jump to other topics
1Components of a Computer
1.1Structure & Function of the Processor
1.2Types of Processors
2Software & Software Development
2.1Systems Software
2.2Applications Generation
2.3Software Development
3Exchanging Data
3.1Compression, Encryption & Hashing
3.3Networks
4Data Types, Data Structures & Algorithms
4.1Data Types
5Legal, Moral, Cultural & Ethical Issues
5.1Computing Related Legislation
6Elements of Computational Thinking
6.1Thinking Abstractly
6.2Thinking Procedurally
6.3Thinking Logically
7Problem Solving & Programming
7.1Programming Techniques
7.2Programming Construction

Unlock your full potential with GoStudent tutoring
Affordable 1:1 tutoring from the comfort of your home
Tutors are matched to your specific learning needs
30+ school subjects covered