Lesson details

Key learning points

  1. In this lesson, we will start to add interactivity to our programs by using the input() function. Whilst learning about input, we will be introduced to functions and data validation techniques. These will be covered in more detail later on in the course.

Licence

This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.

Loading...

3 Questions

Q1.
Which of these variable names would be most suitable to hold data on a person's surname in Python?
lastName
Correct answer: surname
Surname
x
Q2.
Which naming convention is used for a constant in Python?
All lower case (e.g. myconstant)
All lower case with words separated by an underscore (e.g. my_constant)
All upper case (e.g. MYCONSTANT)
Correct answer: All upper case with words separated by an underscore (e.g. MY_CONSTANT)
Q3.
F strings allow you to display variables within print statements. Which TWO symbols are needed for an f string to work?
Correct answer: {}
*
Correct answer: f
s

3 Questions

Q1.
Select the data below that is of the data type: Boolean
"Boolean"
1.0
4/5
Correct answer: True
Q2.
Select the data below that is of the data type: Real / Float
"D"
"Hello"
Correct answer: 1.4
456
Q3.
Which of the code snippets below will assign an integer value to a variable.
number = "5"
number = input()
Correct answer: number = int(input())
number = integer()