Edexcel GCSE Computer Science 1CP2
Computational Thinking
Data
Computers
Networks
Issues and Impact
Problem Solving with Programming
Problem Solving with Programming
Data types, conversion, variables and constants
- 3 things to know
- Paper 2
Overview
Integer, real, Boolean and string in Python, a character as a one-letter string, converting input with int() and str(), and constants in capitals.
What you need to know
Answer each one before you reveal it.
What values can a Boolean hold, and what is one used for?
Describe how Python stores a single character.
Questions from this subtopic
Each one with the model answer underneath.
- 1
Which Python data types store a whole number and a number with a decimal part?
Model answer
A whole number is stored as an integer, type int. A number with a decimal part is stored as a real, type float.
- 2
What values can a Boolean hold, and what is one used for?
Model answer
A Boolean holds either True or False. A Boolean suits a flag such as found, or the result of a test.
- 3
Describe how Python stores a single character.
Model answer
Python stores a character as a string of length one, type str. A value such as "Y" is a one-character string.
- 4
Which data types suit a pupil’s name, age, height in metres and whether they have paid?
Model answer
The name is a string and the age is an integer. The height is a real and the paid flag is a Boolean.
- 5
Which data type should hold a telephone number such as 07700 900123, and why?
Model answer
A telephone number should be held as a string. The number is never used in arithmetic, and an integer would lose the leading zero.
- 6
How does Python decide a variable’s data type?
Model answer
Python takes the data type from the value assigned. The statement price = 2.5 makes price a float.
Other ways to work this
The same content, four other ways.
Everything in your subscription
Runs, plus a mode for every other kind of session.
Every question in Problem Solving with Programming, on a schedule.
Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.