Which of the following are not valid strings in Python?

(a) “Hello”

(b) ‘Hello’

(c) “Hello’

(d) {Hello}

 

 

Answer:

Checking the options:

  • (a) “Hello” - It is a valid string.
  • (b) ‘Hello’ - It is a valid string.   
  • (c) “Hello’ - It is not a valid string as the opening and closing quotes don’t match.   
  • (d) {Hello} - It is not a valid string as it does not start and end with quotes.

So, the correct answer is (c) and (d).

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo