CBSE Class 12 Computer Science Question 31 of 105

Python Revision Tour II — Question 10

Back to all questions
10
Question

Question 10

Which two lines of code are valid strings in Python ?

  1. This is a string
  2. 'This is a string'
  3. (This is a string)
  4. "This is a string"
Answer

'This is a string'
"This is a string"

Reason — Strings are enclosed within single or double quotes.