wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Intro to Python

Total questions: 8

Worksheet time: 8mins

Name
Class
Date
1.

To start programming in Python you have to type <python>

a)

True

b)

False, you don't need to type anything in particular

c)

False, it should be <Python>

d)

False, it should be Python

2.

Comments always start with a _ in Python code

(a)  

3.

To output Hello on the screen, the correct code is:

a)

print("Hello")

b)

print('Hello')

c)

print "Hello"

d)

print 'Hello'

4.

What is missing from this code that allows a user to enter their name:

name = (a)   ("Hi there. What is your name?")

5.

In this code, what is the variable called:

name = input("Hi there and welcome.\nWhat is your name?\n")

a)

name

b)

input

c)

There is no variable

d)

What is your name?

6.

In this code, what does \n do:

name = input("Hi there and welcome.\nWhat is your name?\n"

a)

Prevents errors happening

b)

Creates a comment

c)

Creates a new paragraph

d)

Creates a new line

7.

This code will generate an error. What is wrong with it?

a)

Indents are needed on all the lines of code after the IF

b)

There is a == when it should be =

c)

There is no ELSE or ELIF

d)

The print statement uses "" when it should use ' '

8.

In Python,

== means equal to.

(a)   means becomes.