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.
![Illustrative background for Integer](https://image-v2.cdn.app.senecalearning.com/2018-08/aacf844e-cf35-40d2-a56b-b14419c63a84/numbers-,h_400,q_80,w_640.jpg)
![Illustrative background for Integer ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-08/aacf844e-cf35-40d2-a56b-b14419c63a84/numbers-,h_400,q_80,w_640.jpg)
Integer
Integer
- Whole numbers.
- Examples:
- 12, 0, -142.
![Illustrative background for Float / Real](https://image-v2.cdn.app.senecalearning.com/2018-07/f94ca99e-2d75-4ec4-8b2d-ee2b333d89b4/Resolution-Numbers-Words-Complicated,h_400,q_80,w_640.jpg)
![Illustrative background for Float / Real ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-07/f94ca99e-2d75-4ec4-8b2d-ee2b333d89b4/Resolution-Numbers-Words-Complicated,h_400,q_80,w_640.jpg)
Float / Real
Float / Real
- Fractional numbers.
- Examples:
- 0.42, 1.00.
![Illustrative background for String](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/AQA New Modules/1.1.2/string force,h_400,q_80,w_640.jpg)
![Illustrative background for String ?? "content](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/AQA New Modules/1.1.2/string force,h_400,q_80,w_640.jpg)
String
String
- Text data.
- Example:
- "Hello, world!".
![Illustrative background for Character](https://image-v2.cdn.app.senecalearning.com/2018-05/d02fc304-19d2-4611-a75e-08d788b5e2cd/letters-656514_960_720,h_400,q_80,w_640.png)
![Illustrative background for Character ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-05/d02fc304-19d2-4611-a75e-08d788b5e2cd/letters-656514_960_720,h_400,q_80,w_640.png)
Character
Character
- A single letter of text data.
- Example:
- 'a'.
![Illustrative background for Boolean](https://image-v2.cdn.app.senecalearning.com/2018-07/8ad13556-c0ec-441d-ac9d-f81024e26da2/Positive-Negative-Up-Down-Yes-No-,h_400,q_80,w_640.jpg)
![Illustrative background for Boolean ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-07/8ad13556-c0ec-441d-ac9d-f81024e26da2/Positive-Negative-Up-Down-Yes-No-,h_400,q_80,w_640.jpg)
Boolean
Boolean
- A True or False value.
- Examples:
- True.
- False.
Casting
Casting
Casting is the process of converting data from one type to another.
![Illustrative background for Reasons for casting](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/AQA New Modules/1.1.2/string force,h_400,q_80,w_640.jpg)
![Illustrative background for Reasons for casting ?? "content](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/AQA New Modules/1.1.2/string force,h_400,q_80,w_640.jpg)
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.
![Illustrative background for Casting functions](https://image-v2.cdn.app.senecalearning.com/2018-08/6f2b13b6-c43f-4553-a7b0-3a5ad8b8b888/programming-1873854_1920,h_400,q_80,w_640.png)
![Illustrative background for Casting functions ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-08/6f2b13b6-c43f-4553-a7b0-3a5ad8b8b888/programming-1873854_1920,h_400,q_80,w_640.png)
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
![Go student ad image](/en-GB/revision-notes/_next/image?url=%2Fen-GB%2Frevision-notes%2Fimages%2Fgo-student-uk-ad.jpg&w=640&q=100)
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