placeholder image to represent content

Python basic print, input keyword commands and variable names

Quiz by Paul Cummins

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
12 questions
Show answers
  • Q1
    What will the following Python code output: print('Hello, World!')?
    Hello, World
    Hello, World!
    Hello World!
    Hello World
    30s
  • Q2
    Which of the following variable names is valid in Python?
    @variable
    2ndVariable
    my-variable
    my_variable
    30s
  • Q3
    What will be the output of the following code: name = 'Alice'; print(name)?
    Error
    Alice
    Name
    'Alice'
    30s
  • Q4
    Which of the following will correctly print the value of the variable 'age' which is set to 15?
    print(15)
    print(age)
    print('age')
    print(age + 0)
    30s
  • Q5
    What will the following code print? x = 10; print('The value is', x)
    The value is x
    10
    The value is 10
    The value is
    30s
  • Q6
    Which of the following is an example of a valid print statement in Python?
    print[Hello, World!]
    echo 'Hello, World!'
    println('Hello, World!')
    print('Hello, World!')
    30s
  • Q7
    What will the following code produce? name = 'Bob'; print('Hello, ' + name)
    Hello, Bob!
    Hello, Bob
    Hello, name
    Hello, Bob;
    30s
  • Q8
    What is the output of this Python code snippet? score = 95; print('Your score is:', score)
    Your score is: score
    Your score is: 95.
    score = 95
    Your score is: 95
    30s
  • Q9
    Which of the following variable names is NOT valid in Python?
    variable1
    my_variable
    _variable
    1st_variable
    30s
  • Q10
    What will the following code output? animal = 'dog'; print('I have a', animal)
    I have a dog!
    I have a
    I have a animal
    I have a dog
    30s
  • Q11
    What function is used in Python to read a line of input from the user?
    getInput()
    read()
    input()
    scan()
    30s
  • Q12
    Which of the following statements correctly prompts the user for their name?
    name = read('Enter your name: ')
    name = input('Your name?')
    name = input('Enter your name: ')
    name = getInput('Enter your name: ')
    30s

Teachers give this quiz to your class