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).