+ 2

# Why I'm getting Error in my code? Help me out please!

https://code.sololearn.com/cDU04hrZs33A/?ref=app

21st Oct 2018, 11:18 AM
Vinayak Thube
+ 1
You should change the lines 3, 4, 5 and 6 to: num=int( input("insert number: ")) b=num%10 a=num-b And the last line to: print(a,b)
21st Oct 2018, 3:59 PM
NicolasHM
+ 3
it's only hapen between 11 to 19 isnt it ? so here the a's value are still in integer, meanwhile b now change to string. thats why at you get an error at last statement a+b
21st Oct 2018, 12:07 PM
Taste
+ 1
thank you Taste and NicolasHM 🤙🏻🤙🏻
22nd Oct 2018, 1:20 AM
Vinayak Thube
+ 1
Vinayak Thube, the % operator can pick only a part of a number. Then, i make a division by 10 and pick the rest, that results in exactly the second digit of the number inputed. Example: number=28 28%10 is the same of 28/10 = 2 => 2*10=20 => 28-20=8 and that is what the % do. After, i subtract the second digit of the number, what result in the ten part of the number. Ex: 28%10=8 28-8=20 I hope that you can understand.
22nd Oct 2018, 2:57 AM
NicolasHM
+ 1
NicolasHM again thanks a lot for helping......I understand it🖐️🖐️
22nd Oct 2018, 3:22 PM
Vinayak Thube
0
22nd Oct 2018, 1:36 AM
Vinayak Thube
0
NicolasHM Hey, can you explain me how your answer works? num=int( input("insert number: ")) b=num%10 a=num-b And the last line to: print(a,b) 🤔🤔🤔🤔🤔🤔🤔
22nd Oct 2018, 2:13 AM
Vinayak Thube