Single Choice
Not Set
QWhat will be the output after the following statements?
txt = "For only {price:.2f} dollars!"
print(txt.format(price = 85))
ID: #3651
String Formatting in Python
293 views
Question Info
#3651Q ID
Not SetDifficulty
String Formatting in PythonTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
- The format() method formats the specified value(s) and insert them inside the string's placeholder.
- The placeholder is defined using curly brackets: {}. Read more about the placeholders.
- The format() method returns the formatted string.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic