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)
Escuela, estudio y materia
- Institución
- CNM 140
- Grado
- CNM 140
Información del documento
- Subido en
- 21 de junio de 2025
- Número de páginas
- 16
- Escrito en
- 2024/2025
- Tipo
- Examen
- Contiene
- Preguntas y respuestas
Temas
-
cnm 140 exam 2 with questions and answers