input() function, online
Six activities your students do on their own devices. See who's finished, and their scores.
Learning
Understanding
Testing
input() function in one minute
What students need to know
input("Name") is valid syntax with matching double quotes. input() displays the prompt string, then pauses until the user presses Enter.
The prompt is optional — without it, input() just waits silently. The prompt must be a string in quotes — otherwise Python looks for a variable called Hi.
Mistakes students make
- Misspelling: imput.
- Missing closing bracket.
- Capital I error.
- Missing opening quote.
What students will learn in this module
Every question in Module 2
Quick questions
- What does
input("Name: ")do?AShows 'Name: ' then waitsBShows 'Name: ' then continues - What does
input()without a prompt show?AThe word 'input()'BNothing - just waits for input - When does the program continue after
input()?AImmediatelyBAfter user presses Enter - What does
input('Age: ')display?AAge: Binput('Age: ') - Which is correct?Ainput("Hi")Binput(Hi)
Key terms
Students type the meaning of:
input('Press Enter')
Match the pairs
input("Name')Match it to what it doesinput(Name)Match it to what it doesinput("Name")Match it to what it doesinput()Match it to what it doesinput('>>> ')Match it to what it doesinput('Age: ')Match it to what it doesFill in the blanks
_____('Name: ')input_'Age: ')
input('City: '_input('Email_______('Press Enter'_
Spot the error
Question 1
Aprint('Welcome')Bimput('Name: ')Cinput('Age: ')
Question 2
Ainput('First name: ')Binput('Last name: 'Cinput('Email: ')
Question 3
Aprint('Registration')Binput('Name: ')CInput('Age: ')Dinput()
Question 4
Ainput('Username: ')Binput(Password: ')Cprint('Login complete')
Question 5
Aprint('Enter details')Binput('Name: ')Cinput('Age: ')Dinput 'City: ')
