Why I'm getting Error in my code? Help me out please!
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)
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
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.
NicolasHM again thanks a lot for helping......I understand it🖐️🖐️
NicolasHM 🤙🏻🤙🏻That's great your answer code helped a lot......for making advance version of that🤘🏻Thanks a lot
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) 🤔🤔🤔🤔🤔🤔🤔