TypeError Traceback (most recent call last) Cell In[9], line 4 2 y = 20 3 total = x + y ----> 4 print("The total is: " + total) TypeError: can only concatenate str (not "int") to str
>>> x=10 >>> y=20 >>> total = x + y >>> print("the total is: " + total) Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate str (not "int") to str
implicit type conversion does not work with ambiguous input such as in case of string concatenation for avoiding scenarios such as what should be the output in case of '5' + 5
>>> x = 10 >>> y = 20 >>> total = x + y >>> print("the total is: " + total) Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate str (not "int") to str
TypeError Traceback (most recent call last)
Cell In[9], line 4
2 y = 20
3 total = x + y
----> 4 print("The total is: " + total)
TypeError: can only concatenate str (not "int") to str
They really mean it when they say "in details".
>>> x=10
>>> y=20
>>> total = x + y
>>> print("the total is: " + total)
Traceback (most recent call last):
File "", line 1, in
TypeError: can only concatenate str (not "int") to str
Yeah only with int multiple char
Or int multiple int
Or char plus char
Or making a int string by adding quotation and add them...❤
Hope it helps ❤❤
implicit type conversion does not work with ambiguous input such as in case of string concatenation for avoiding scenarios such as
what should be the output in case of '5' + 5
I don't understand
Not one of the best, the One best channel ❤
x = 10
y = 20
total = x + y
print("The total is: " + str(total))
Your videos are really helpful. Kindly Please complete the DBMS series taught by prabhu subramanian. Thanks ❤️❤️
yesterday i finished from 1 to 11
today i finished it till 32 , and the process is still going on...!
i 'will comment it again.
it will be error because we can't just add directly str and int value. please correct me if I'm wrong
we cannot concatenate string and number in print statement. we need to place a comma before + total
suppose if there is 5.98+10 then it should be 15 according to rule of conversion
sir plese upload quikly as possible we are eagerly waiting
Sir please continue C++ series......
x = 10
y = 20
tot = x + y
print("The total is: " + str(tot))
'The total is: 30'
What is higher data type and what is lower data type
Output=the total is :60
ERROR!
Traceback (most recent call last):
File "", line 4, in
TypeError: can only concatenate str (not "int") to str
=== Code Exited With Errors ===
error . sting is not concatenated with int type
Error, as string and int can't be sum together.
And the solution is to remove concatenation sign from total
And put a comma before it
output: The Total is: 30
output: The total is: 30
❤❤
why not 16 instead of 15
I got an error. But in JAVA compulsory it won't get an error
30
Class 11 CBSE
Computer Science students ❤
Error
Type error
'The total is:+ 30'
>>> x = 10
>>> y = 20
>>> total = x + y
>>> print("the total is: " + total)
Traceback (most recent call last):
File "", line 1, in
TypeError: can only concatenate str (not "int") to str
x = 10
y = 20
total = x+y
print("the total is: "+ str(total))
x=10
y=20
sum=x+y
print("The total is: "+str(sum)
30
30