Computer Science
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
Python String Manipulation
2 Likes
Answer
Output
mywork
Reason — The + operator creates a new string by joining the two operand strings.
Answered By
3 Likes
Related Questions
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)
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"
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
Which line of code produces an error ?
- "one" + 'two'
- 1 + 2
- "one" + "2"
- '1' + 2