f-Strings


Questions

f-strings

  1. What are the printed outputs for the following print function calls?

    1.1. print(f"{1 + 1}")

    1.2. print(f"C{'OM'}P {100 + 10}")

    1.3. print(f"This statement is {not (True or False)}!")

    1.4. print(f"Question: Is {55} even? Answer: {55 % 2 == 0}")

SHOW SOLUTIONS

1.1. 2

1.2. COMP 110

1.3. This statement is False!

1.4. Question: Is 55 even? Answer: False

 

Contributor(s): Benjamin Eldridge