String Formatting in Python

String Formatting in Python

12th Grade

10 Qs

quiz-placeholder

Similar activities

visualisasi Data

visualisasi Data

9th - 12th Grade

10 Qs

among us

among us

1st Grade - Professional Development

10 Qs

JavaScript Control Structures Review

JavaScript Control Structures Review

12th Grade

10 Qs

Data Type Review

Data Type Review

KG - Professional Development

12 Qs

Java Script

Java Script

10th - 12th Grade

10 Qs

Python Fundamentals and Programming

Python Fundamentals and Programming

11th - 12th Grade

13 Qs

Arc Welding

Arc Welding

KG - University

10 Qs

Technology Tuesday

Technology Tuesday

KG - University

10 Qs

String Formatting in Python

String Formatting in Python

Assessment

Quiz

Other

12th Grade

Medium

Created by

Teetreeo Pittman

Used 6+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the result of the following code? name = 'John' age = 25 message = 'My name is ' + name + ' and I am ' + str(age) + ' years old.' print(message)

My name is John and I am 25 years.

My name is John and I am 25 years old!

My name is John and I am 25 years old.

My name is John and I am 25.

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is string formatting with placeholders in Python?

A technique to convert strings into integers using placeholders and the % operator.

A method to concatenate strings in Python.

A way to remove values from a string using placeholders and the % operator.

A way to insert values into a string using placeholders and the % operator.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of the + operator in Python?

The purpose of the + operator in Python is to perform addition or string concatenation.

The purpose of the + operator in Python is to perform subtraction.

The purpose of the + operator in Python is to perform multiplication.

The purpose of the + operator in Python is to perform division.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of the * operator in Python?

The * operator in Python is used for addition of two numbers.

The * operator in Python is used for division of two numbers.

The * operator in Python is used for multiplication of two numbers or for repeating a string a certain number of times.

The * operator in Python is used for subtraction of two numbers.

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of the str() function in Python?

To convert any data type to a string data type

To create a new string variable

To convert a string to another data type

To delete a string variable

6.

FILL IN THE BLANK QUESTION

2 mins • 1 pt

Complete the following code to make the string all lowercase:

message = "My buddy Brandon is a GREAT basketball player for his age!"

print(message._____())

7.

MULTIPLE CHOICE QUESTION

1 min • 5 pts

Which answer completes the following code to capitalize the first letter of the first word?

bugsb = What's your favorite cartoon?

print(bugsb.______())

Swapcase

Upper

Capitalize

Isupper

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?