input() function

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

input() function

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does input("Name: ") do?
A Shows 'Name: ' then waits
B Shows 'Name: ' then continues
2. What does input() without a prompt show?
A The word 'input()'
B Nothing - just waits for input
3. When does the program continue after input()?
A Immediately
B After user presses Enter
4. What does input('Age: ') display?
A Age:
B input('Age: ')
5. Which is correct?
A input("Hi")
B input(Hi)

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1input("Name') AMismatched: Quotes
2input(Name) BValid: Syntax
3input("Name") COk: No prompt
4input() DShows: Age: then waits
5input('>>> ') EError: Missing quotes
6input('Age: ') FShows: >>> then waits

Definitions

input('Press Enter')

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
_____('Name: ')
2.
input_'Age: ')
3.
input('City: '_
4.
input('Email__
5.
_____('Press Enter'_

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A print('Welcome')
B imput('Name: ')
C input('Age: ')
Question 2
A input('First name: ')
B input('Last name: '
C input('Email: ')
Question 3
A print('Registration')
B input('Name: ')
C Input('Age: ')
D input()
Question 4
A input('Username: ')
B input(Password: ')
C print('Login complete')
Question 5
A print('Enter details')
B input('Name: ')
C input('Age: ')
D input 'City: ')

Answer Key

input() function
Section A: Quick Questions
Q1
A — Shows 'Name: ' then waits
Q2
B — Nothing - just waits for input
Q3
B — After user presses Enter
Q4
A — Age:
Q5
A — input("Hi")
Section B: Match the Pairs
Q1
input("Name') → Mismatched: Quotes
Q2
input(Name) → Error: Missing quotes
Q3
input("Name") → Valid: Syntax
Q4
input() → Ok: No prompt
Q5
input('>>> ') → Shows: >>> then waits
Q6
input('Age: ') → Shows: Age: then waits
Section C: Definitions
Q1
input('Press Enter') — Pauses program and waits for user to press Enter key.
Section D: Fill in the Blanks
Q1
input('Name: ')
Q2
input('Age: ')
Q3
input('City: ')
Q4
input('Email')
Q5
input('Press Enter')
Section E: Spot the Error
Q1
B — Misspelling: imput
Q2
B — Missing closing bracket
Q3
C — Capital I error
Q4
B — Missing opening quote
Q5
D — Missing opening bracket