Computer Science
Which two lines of code are valid strings in Python ?
- This is a string
- 'This is a string'
- (This is a string)
- "This is a string"
Python String Manipulation
1 Like
Answer
'This is a string'
"This is a string"
Reason — Strings are enclosed within single or double quotes.
Answered By
1 Like
Related Questions
What is the value of the following expression ?
3 + 3.00, 3**3.0- (6.0, 27.0)
- (6.0, 9.00)
- (6, 27)
- [6.0, 27.0]
- [6, 27]
List AL is defined as follows : AL = [1, 2, 3, 4, 5]
Which of the following statements removes the middle element 3 from it so that the list AL equals [1, 2, 4, 5] ?- del AL[2]
- AL[2:3] = []
- AL[2:2] = []
- AL[2] = []
- AL.remove(3)
You have the following code segment :
String1 = "my" String2 = "work" print(String1 + String2)
What is the output of this code?
- my work
- work
- mywork
- my
You have the following code segment :
String1 = "my" String2 = "work" print(String1+String2.upper())
What is the output of this code?
- mywork
- MY Work
- myWORK
- My Work