WorksheetsIntro to Python
Total questions: 8
Worksheet time: 8mins
To start programming in Python you have to type <python>
True
False, you don't need to type anything in particular
False, it should be <Python>
False, it should be Python
Comments always start with a _ in Python code
(a)
To output Hello on the screen, the correct code is:
print("Hello")
print('Hello')
print "Hello"
print 'Hello'
What is missing from this code that allows a user to enter their name:
name = (a) ("Hi there. What is your name?")
In this code, what is the variable called:
name = input("Hi there and welcome.\nWhat is your name?\n")
name
input
There is no variable
What is your name?
In this code, what does \n do:
name = input("Hi there and welcome.\nWhat is your name?\n"
Prevents errors happening
Creates a comment
Creates a new paragraph
Creates a new line
This code will generate an error. What is wrong with it?
Indents are needed on all the lines of code after the IF
There is a == when it should be =
There is no ELSE or ELIF
The print statement uses "" when it should use ' '
In Python,
== means equal to.
(a) means becomes.
