Complete the code to create a string variable named greeting with the value Hello.
greeting = [1]The string must be enclosed in quotes. Double quotes or single quotes both work, but here the correct option uses double quotes properly.
Complete the code to create a multi-line string using triple quotes.
text = [1]This is line one. This is line two. [2]
Triple single quotes or triple double quotes can create multi-line strings. Here triple single quotes are used.
Fix the error in the code to correctly print a string with a quote inside.
print([1])
A double-quoted string can contain an unescaped single quote (apostrophe) inside. Option A does this correctly and prints: It's a sunny day
Fill both blanks to create a string that includes a newline character and prints correctly.
message = [1] + [2] print(message)
The first blank is a string with a newline character at the end. The second blank is the next string. Concatenating them prints Hello on one line and World on the next.
Fill all three blanks to create a formatted string using f-string syntax that shows a name and age.
name = "Alice" age = 30 info = [1]"Name: [2], Age: [3]" print(info)
To create a formatted string, prefix the string with f or F. Inside the string, use curly braces to insert variables. Here, name and age are inserted.