levo

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.

Your recallNot started
Key term

Which Python data types store a whole number and a number with a decimal part?

Key term

What values can a Boolean hold, and what is one used for?

Key term

Describe how Python stores a single character.

Questions from this subtopic

Each one with the model answer underneath.

  1. 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. 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. 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. 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. 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. 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.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Computational Thinking
Data
Computers
Networks

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

The check is 45 + 27 = 72.
denarybinaryhexadecimal

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AA normal test value is 14.
BA boundary test value is 16.
CAn erroneous test value is 20.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

A kibibyte (KiB) is 1,024 bytes. The figure 1,024 is 2¹⁰.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Problem Solving with Programming, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.