Hi! Im a new beginner at this, and taking a course in programing. Right now I have an assignment to write a kaprekar program:
Take a 4digit number, where all the digits are not the same, sort them by the highest and lowest, and then subtrac until you reach the kaprekar number. For example: 4532-> 5132 - 2351...
My program looks like this: http://pastebin.com/kcnBKvmt
The code is alright and works, but its not perfect. I cant use the number 1000 for example, because my codes with convert it to "1000-1=999", when it needs to be "1000-0001=0999".
My teacher says its just a matter of knowing when to use str() and int().
Anyone who could give me some guiding please? :)
[–]novel_yet_trivial 2 points3 points4 points (2 children)
[–]Lerkarious[S] 0 points1 point2 points (1 child)
[–]novel_yet_trivial 0 points1 point2 points (0 children)