#TC1014<\/a> #WSQ11<\/a> #awesome<\/a><\/strong><\/p>\n this program recives two number values, a low number and a higher number, and check the numbers from the lower to the highest number reporting: the range of numbers analyzed, number of natural palindromes, number of non-lychrel numbers, the amount of lychrel numbers found and print the lychrel numbers found.<\/strong><\/p>\n to start i created a function to invert the integers so i could compare them.<\/strong><\/p>\n def reverse(a):<\/strong><\/p>\n a = str(a)<\/strong><\/p>\n a = a[::-1]<\/strong><\/p>\n a = int(a)<\/strong><\/p>\n return a<\/strong><\/p>\n this turns 123 into “123” into “321” into 321.<\/strong><\/p>\n a function to determine if a number is a natural palindrome.<\/strong><\/p>\n def palin(a):<\/strong><\/p>\n a1 = a<\/strong><\/p>\n a2 = reverse(a)<\/strong><\/p>\n if a1 == a2:<\/strong><\/p>\n return 1<\/strong><\/p>\n else:<\/strong><\/p>\n return 0<\/strong><\/p>\n and a function to add the numbers to their inverse until they become a palindrome or reach a set amount of tries.<\/strong><\/p>\n def nopalin(a)<\/strong><\/p>\n c = 0<\/strong><\/p>\n while c < 30:<\/strong><\/p>\n a1 = a<\/strong><\/p>\n a2 = reverse(a1)<\/strong><\/p>\n a3 = a1+a2<\/strong><\/p>\n a4 = reverse(a3)<\/strong><\/p>\n if a3 == a4:<\/strong><\/p>\n return 1<\/strong><\/p>\n break<\/strong><\/p>\n if a3 != a4:<\/strong><\/p>\n a = a3<\/strong><\/p>\n c += 1<\/strong><\/p>\n if c >= 30:<\/strong><\/p>\n return 0<\/strong><\/p>\n that will take a number, invert it and add them until it becomes a palindrome for 30 tries, if it does not becomes a palindrome before then it will count as a lychrel number. after those 3 functions all you need is arrange them and add counters an a print order for the lychrel number found.<\/strong><\/p>\n <\/p>\n reference for the reverse function:<\/strong><\/p>\n http:\/ my code in github:<\/strong><\/p>\n https:\/ #TC1014 #WSQ11 #awesomethis program recives two number values, a low number and a higher number, and check the numbers from the lower to the highest number reporting: the range of numbers analyzed, number of natural palindromes, number of non-… Continue reading