replace() isnumeric() challenge

replace() isnumeric() challenge

9th - 12th Grade

9 Qs

quiz-placeholder

Similar activities

Mathematical Operators Python Assessment

Mathematical Operators Python Assessment

9th - 12th Grade

10 Qs

Collections 101

Collections 101

1st - 12th Grade

10 Qs

Základní literární pojmy

Základní literární pojmy

6th - 9th Grade

12 Qs

Financial Sector (CSEC)

Financial Sector (CSEC)

5th Grade - University

14 Qs

TLE bookkeeping pretest

TLE bookkeeping pretest

9th Grade

10 Qs

Q2_WEEK 2_QUIZ

Q2_WEEK 2_QUIZ

11th Grade

10 Qs

Structural Aspects in Print media

Structural Aspects in Print media

9th - 11th Grade

12 Qs

S3 DTP

S3 DTP

9th Grade

10 Qs

replace() isnumeric() challenge

replace() isnumeric() challenge

Assessment

Quiz

Other

9th - 12th Grade

Hard

Created by

Devin Lachapelle

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

boolean
string

float

integer

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What data type does the method isnumeric() return?

boolean
string

float

integer

Answer explanation

A boolean value is either True or False.

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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"

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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."

5.

DRAW QUESTION

1 min • Ungraded

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

Media Image

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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

True

False

7.95

"7.95"

8.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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

I like rice.
I like pasta.

False

Answer explanation

In the second line, we use the replace() method to swap "pasta" with "rice." However, we don't actually store this new string anywhere or do anything with the new string at all, so the original string stored in text stays the same.

9.

FILL IN THE BLANK QUESTION

1 min • 1 pt

I can use the ______ operator to calculate the remainder when dividing two numbers.