Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

replace() isnumeric() challenge

Total questions: 9

Worksheet time: 7mins

Name
Class
Date
1.

What data type do the methods lower(), upper(), replace(), and capitalize() return?

a)
boolean
b)
string
c)

float

d)
integer
2.

What data type does the method isnumeric() return?

a)
boolean
b)
string
c)

float

d)
integer
3.

Given the Python code below, what will be the output?

word = "hello"

result = word.replace("l", "X")

print(result)

a)

a) "heXlo"

b)

b) "heXXo"

c)

c) "hello"

d)

d) "heXIX"

4.

What is the output of the following Python code?

sentence = "Hello world! Python is fun."

new_sentence = sentence.replace("Python", "Java").replace("fun", "exciting")

print(new_sentence)

a)

a) "Hello world! Java is exciting."

b)

b) "Hello world! Java is fun."

c)

c) "Hello world! Python is exciting."

d)

d) "Hello world! Python is fun."

5.

Use your drawing skills to give this python a more interesting look.

6.

What will be the output of the following Python code?
text = "2+2+2=6"

new_text = text.replace("+","")

print(new_text)

a)

222=6

b)

22+2=6

c)

2 2 2=6

d)

2+22=6

7.

What value will the variable var be set to?
var = "7.95".isnumeric()

a)

True

b)

False

c)

7.95

d)

"7.95"

8.

What will be the value of the text variable after the following Python code is run?
text = "I like pasta."

text.replace("pasta", "rice")

a)

True

b)
I like rice.
c)
I like pasta.
d)

False

9.

I can use the (a)   operator to calculate the remainder when dividing two numbers.