CNM 140 Exam 2 with Questions and Answers
CNM 140 Exam 2 with Questions and Answers What placeholders are used when dealing with f-strings? a. ( ) b. [ ] c. { } d. : ANSWER c. { } Use the price variable and f-string syntax to display the price with two decimals: price = 69 txt = f"The price is {__________} dollars" print(txt) a. :.2f b. price:.2f c. price * 100.00 d. price:2f ANSWER b. price:.2f Use an if statement inside the f-string placeholders to return 'perfect' if the price is 100, and 'ok' if the price is not 100: price = 100 txt = f"It is {'perfect' ____________________________ 'ok'}" print(txt)
Written for
- Institution
- CNM 140
- Course
- CNM 140
Document information
- Uploaded on
- June 21, 2025
- Number of pages
- 16
- Written in
- 2024/2025
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
cnm 140 exam 2 with questions and answers