SPS 2019 P2 Solution
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesComputing Prelim 2019 Paper 2 Solutions result = [] limit = int(input("Range of numbers to be tested is 1 to n inclusive. State your n: ")) print("The program is now checking for disarium numbers from 1 to {}...".format(limit)) for number in range(1, limit+1): remaining = 0 sum_digits = 0 number_str = str(number) counter = len(number_str) test_number = number while test_number > 0: remaining = test_number%10 sum_digits += (remaining**counter) test_number = test_number//10 counter -= 1 if sum_digits == number: result.append(number) print("The disarium numbers between 1 to {} are {}: ".format(limit, result))
Content continues in the PDF. Download PDF
Related notes
- SST (for revision practice) 2024 S3 Computing EOY P2 QP_FinalExam Papers · 2024
- Computing o level notes Notes/Practices · 2023
- BVSS Prelim P1 MSExam Papers · 2024
- BVSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices
- SST 2024 Prelim Paper 1 Ans [revised for 2025] Exam Papers · 2024
- SST 2024 Prelim Paper 1 [revised for 2025] Exam Papers · 2024
- [Notes for Computing] All Definitions/ TermsNotes/Practices · 2025
- [Notes for Computing] Heavily Compressed TextbookNotes/Practices · 2025
- All Computing Terms/DefinitionsNotes/Practices · 2025
- See all Computing notes

