NEW
Font size
S
M
L
XL
WorksheetsPython String Slicing
Total questions: 10
Worksheet time: 5mins
Name
Class
Date
1.
word = "hello"
print(word)
The result will be ___________
a)
result
b)
"hello"
c)
word
2.
word = "hello"
word[0]
What is the output of the code above?
a)
"h"
b)
"e"
c)
"l"
d)
"o"
3.
Run the code below
word = "hello"
word[3]
a)
el'
b)
'lo'
c)
h
d)
'l'
4.
alpha = 'abcdef'
alpha[0:3]
a)
'abc'
b)
'abcd'
c)
'abcde'
d)
none
5.
alpha = 'abcdef'
alpha[0:4]
a)
'ab'
b)
'abc'
c)
'abcd'
6.
alpha = 'abcdef'
alpha[2:4]
a)
'cd'
b)
b'cd'
c)
'abcd'
d)
'cde'
7.
alpha = 'abcdef'
alpha[2:]
a)
'cdf'
b)
'ef'
c)
'def'
d)
'cdef'
8.
alpha = 'abcdef'
alpha[0:6:2]
a)
'ace'
b)
'abce'
c)
'acde'
d)
'ce'
9.
What code do you use to move a sentence or words to another line?
a)
\a
b)
\n
c)
\t
d)
\g
10.
What code is used to create space between words or sentences,. tab space?
a)
\t
b)
\n
c)
\tn
d)
None
Reset
