+ 2

String operation

I don't understand it at all

14th Apr 2018, 9:59 AM
Elisha Miracle
Elisha Miracle - avatar
6 Answers
+ 3
String: a=str('1'+'1') print(a) Output: 11 Integer: b=int(1+1) print(b) output: 2
14th Apr 2018, 1:25 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 1
Any particular examples that have been bothering you?
14th Apr 2018, 10:39 AM
Ridwan Abrar
Ridwan Abrar - avatar
+ 1
Aye. The first one takes 1 as an individual string, think like a character and adds 'em so u get 11.
14th Apr 2018, 1:29 PM
Ridwan Abrar
Ridwan Abrar - avatar
+ 1
Strings are more like arrays of characters.
14th Apr 2018, 1:30 PM
Ridwan Abrar
Ridwan Abrar - avatar
+ 1
thanks
14th Apr 2018, 2:02 PM
Elisha Miracle
Elisha Miracle - avatar
+ 1
Repeat lesson, if that doesn't help, repeat earlier lessons.
14th Apr 2018, 5:02 PM
Seb TheS
Seb TheS - avatar