Font size
Worksheetsprint(), int and input() - Python
Total questions: 11
Worksheet time: 8mins
What is missing from this line of code?
print(Hello world!)
Speech marks!
print("Hello world!")
Capital P!
Print(Hello world!)
Space before brackets!
print (Hello world)
What is wrong with this line of code?
(print "how tall are you?")
Needs another pair of brackets
(print("how tall are you?"))
Remove outside brackets, surround text with brackets instead:
print("how tall are you?")
What needs correcting in this line of code?
print('Goodbye world!')
Add an extra space after print
print ('Goodbye world!')
Single quotes should be double quotes
print("Goodbye world!")
Remove exclamation mark
print('Goodbye world')
What needs to be fixed in this line of code?
print(3 + 5 =, 3 + 5)
Remove parentheses
print 3 + 5 =, 3 + 5
Add quotes around text
print("3 + 5 =", 3 + 5)
Remove comma
print(3 + 5 = 3 + 5)
What needs to be added to make num1 a whole number?
num1 = input("Enter an integer")
Wrap the input inside an int() function
num1 = int(input("Enter an integer"))
Clearer text inside the input brackets
num1 = input("Enter an integer - which is a whole number, no decimals!")
Turn num1 into a whole number
num1 = (a) input("Enter an integer"))
What will the following code print if you type in 7?
num1 = input("Enter an integer")
print("Your number becomes: ", num1 + 10)
Your number becomes 17
Your numbers becomes: 710
TypeError: must be str, not int
Your number becomes: 17
What will the following code print if you type in 7?
num1 = int(input("Enter an integer"))
print("Your number becomes: ", num1 + 10)
Your number becomes 17
Your number becomes: 17
Your number becomes 710
What is the best way to ask for, and be able to use two integers from a user?
nums = int(input("Enter two numbers"))
num1=int(input("Enter first number"))
num2=int(input("Enter second number"))
What will the following code print if you type in 5?
num1 = int(input("Enter an integer"))
print("Your number becomes: ", num1 * 2)
Your number becomes 10
Your number becomes: 10
Your number becomes 52
Your number becomes: 52
What is the output of this code if you input '3'?
num1 = input("Enter a number")
print("Your number is: ", num1 + num1)
Your number is: 3
Your number is: 33
Your number is: 6
