## Saturday, August 29, 2020

Solution Exercise 201: list of divisors whose last digit is equal to 1

#### Exercise 201

Write an algorithm as a python function that takes as parameters an integer n and which returns the list of divisors d whose last digit is equal to 1. Test your algorithm for n = 727821.

#### Solution

``````def listDiv(n):
# initializing searched list
listDiv =[]
# Browsing through all integers i = 1  2  3 ... n
for i in range(1, n+1):
# the last dijit of i is equal to i%10, see the previous exercise 72
if( n%i == 0 and i%10 == 1):
listDiv.append(i)
return listDiv
# Testing algorithm
print("The list of divisors of 727821  whose last digit is equal to 1 is L = ", listDiv(727821))
``````

Younes Derfoufi
my-courses.net

## Python Exercises With Solutions

1. Python Arithmetic Exercises
2. Equations & System Of Equations
3. Polynomials and Functions
4. Python Arithmetic Exercises
5. Numpy, Matplolib, Sympy , Scipy - Exercises
6. Python Arithmetic Exercises

Younes Derfoufi

## Sample Text 