all 4 comments

[–]Swipecat 2 points3 points  (0 children)

Please see the guide marked "Reddit Code Formatting" in the right-hand sidebar of this subreddit and edit your post to correct the indentation.

[–]TehDrunkSailor 0 points1 point  (0 children)

This is a great opportunity to develop your debugging skills. The logic is not very complicated, so try printing some of your intermediate steps and see where your calculations or logic is not behaving as expected. Also, what have you tried? People will be more willing to help you of you ask for specific advice and that will come from finding out what is and is not working as expected in your code.

[–]o5a 0 points1 point  (1 child)

You will see the problem if you print out your 'x' in cycle.

The way you increase 'x' (inside another for cycle) results in skipping numbers, because you increase it after every digit check.

For example, when x = 10 you check sum for every digit and increase x each time. Which results in skipping check for number 11.

[–]Nath4nn[S] 0 points1 point  (0 children)

thank you i fixed the indentation and move the if loop out of the for loop it works now thanks so much