Bird
0
0

How can you print a string that contains both single and double quotes without using escape characters?

hard📝 Application Q9 of 15
Python - Input and Output
How can you print a string that contains both single and double quotes without using escape characters?
AUse double quotes and escape single quotes
BUse single quotes and escape double quotes
CUse triple quotes like '''He said, "It's fine"'''
DUse raw strings with single quotes
Step-by-Step Solution
Solution:
  1. Step 1: Understand triple quotes usage

    Triple quotes allow strings to contain both single and double quotes without escaping.
  2. Step 2: Check the example

    Using '''He said, "It's fine"''' prints the string exactly with both quote types.
  3. Final Answer:

    Use triple quotes like '''He said, "It's fine"''' -> Option C
  4. Quick Check:

    Triple quotes allow mixed quotes without escapes [OK]
Quick Trick: Triple quotes handle both single and double quotes easily [OK]
Common Mistakes:
MISTAKES
  • Trying to escape all quotes
  • Using raw strings incorrectly
  • Confusing quote types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes