wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python String

Total questions: 9

Worksheet time: 4mins

Name
Class
Date
1.

An example of Python code that creates a variable and assigns it to the string "Hello!"

a)

goodbye = "HAVE A GREAT DAY!"print(goodbye)

b)

welcome = "Hello!"

c)

"Today I had \"pizza"\ for lunch"

d)

print("Hello!" * 3)

2.

When Python sees ________ around text, it reads it as a string

a)

variables

b)

operators

c)

question marks

d)

quotation marks

3.

Say s=”hello” what will be the return value of type(s)?

a)

STRING

b)

bool

c)

str

d)

String

4.

What will be the output of the following Python code?

print("D", end = ' ')

print("C", end = ' ')

print("B", end = ' ')

print("A", end = ' ')

a)

DCBA

b)

A,B,C,D

c)

D C B A

d)

D

C

B

A

5.

What will be the output of the “hello” +1+2+3?

a)

hello123

b)

hello

c)

Error

d)

hello6

6.

What is the output from this code?

a)

ell

b)

llo

c)

ello,

d)

Hello

7.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city
8.

Each item in a string has an "address" or index. The first index in a Python string is what?

a)

0

b)

1

c)

a

d)

A

9.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints