Informatics Practices
What will be the correct output of the following code:
a, b = '30', '5'
c = a+b
print(c)
- 19
- 305
- ValueError
- TypeError
Python Funda
3 Likes
Answer
305
Reason — In the above code, a and b are strings as they are enclosed in quotes. When using the + operator with strings, it performs concatenation rather than arithmetic addition. Therefore, a + b results in the concatenation of '30' and '5', producing '305'.
Answered By
3 Likes
Related Questions
The superimposition of computer-generated perceptual information over the existing physical surrounding is called …………… .
Seema is collecting data for her science project from science blogs, e-newspapers and various websites this process is known as …………… .
- Data Capturing
- Data Retrieval
- Data Storage
- All of these
If you add a new column in a table using the Alter Table command, which value is inserted in the new column for the existing rows?
If a < b and a < c then
- a is the greatest number
- a is the smallest number
- b is the greatest number
- c is the greatest number