+ 1
a='12' 12 is integer or string? Please explain guys?
string
3 Respostas
+ 7
it is in quotation marks, so it is string, with two chars '1' and '2'
a='12'
print( type(a) ) # <class 'str'>
print( a + 'text' ) # 12text
+ 2
Remember that everything between ' ' or " " is always string.
if you want to convert into it integer.
then use int function for this.
print(int('2')) now it is integer because we are converting into integer with the help of int function.
0
it is a string