a='12' 12 is integer or string? Please explain guys? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

a='12' 12 is integer or string? Please explain guys?

string

29th Nov 2018, 9:57 AM
Harish Chandan Chavan
3 Answers
+ 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
29th Nov 2018, 10:05 AM
zemiak
+ 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.
29th Nov 2018, 3:57 PM
Maninder $ingh
Maninder $ingh - avatar
0
it is a string
3rd Dec 2018, 12:58 PM
Nikhil kumar singh
Nikhil kumar singh - avatar