Complete the code to print the name using an f-string.
name = "Alice" print(f"Hello, [1]!")
The variable name is used inside the f-string without quotes to insert its value.
Complete the code to format the number with two decimal places using an f-string.
price = 9.8765 print(f"Price: $[1]")
The format specifier :.2f rounds the number to two decimal places in the f-string.
Fix the error in the f-string to correctly display the age variable.
age = 30 print(f"Age: [1] years")
The variable age should be inside the braces without extra characters or quotes.
Fill both blanks to create an f-string that shows the product name and its price with two decimals.
product = "Book" price = 12.5 print(f"[1] costs $[2]")
The first blank uses the variable product to show the name. The second blank uses price:.2f to format the price with two decimals.
Fill all three blanks to create an f-string that shows the user's name in uppercase, their age, and a message.
user = "emma" age = 25 print(f"User: [1], Age: [2], Message: [3]")
upper() method.user without upper().The first blank uses user.upper() to show the name in uppercase. The second blank shows the age variable. The third blank is a string message inside quotes.