Computer Science
What is the output of this code ?
>>> int("3" + "4")
- "7"
- "34"
- 34
- 24
Python String Manipulation
1 Like
Answer
Output
34
Reason — The +
operator concatenates two strings and int
converts it to integer type.
int("3" + "4")
= int("34")
= 34
Answered By
3 Likes
Related Questions
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
Which line of code will cause an error ?
1. num= [5, 4, 3, [2], 1] 2. print(num[0]) 3. print(num[3][0]) 4. print(num[5])
- Line 3
- Line 2
- Line 4
- Line 1
Which is the correct form of declaration of dictionary ?
- Day = {1:'Monday', 2:'Tuesday', 3:'wednesday'}
- Day = {1;'Monday', 2;'Tuesday', 3;'wednesday'}
- Day = [1:'Monday', 2:'Tuesday', 3:'wednesday']
- Day = {1'monday', 2'tuesday', 3'wednesday'}