Worksheetsreplace() isnumeric() challenge
Total questions: 9
Worksheet time: 7mins
What data type do the methods lower(), upper(), replace(), and capitalize() return?
float
What data type does the method isnumeric() return?
float
Given the Python code below, what will be the output?
word = "hello"
result = word.replace("l", "X")
print(result)
a) "heXlo"
b) "heXXo"
c) "hello"
d) "heXIX"
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) "Hello world! Java is exciting."
b) "Hello world! Java is fun."
c) "Hello world! Python is exciting."
d) "Hello world! Python is fun."
Use your drawing skills to give this python a more interesting look.
What will be the output of the following Python code?
text = "2+2+2=6"
new_text = text.replace("+","")
print(new_text)
222=6
22+2=6
2 2 2=6
2+22=6
What value will the variable var be set to?
var = "7.95".isnumeric()
True
False
7.95
"7.95"
What will be the value of the text variable after the following Python code is run?
text = "I like pasta."
text.replace("pasta", "rice")
True
False
I can use the (a) operator to calculate the remainder when dividing two numbers.
