## Wednesday, August 26, 2020

Solution Exercise 81: Numner of ways to paid 10 Euros, using 1 , 2 and 5 Euros coins

#### Exercise 81

Create a Python algorithm that calculates the number of ways to pay 10 Euros, using the 1 Euro, 2 Euro and 5 Euro coins.

#### Solution

``````# initialize number of ways to 0
numberOfWays = 0

# Browsing through  the integers from 0 to 10 and test if the paid sum  1 * m + 2 * n + 5 * p is equal to 10
for m in range(0,11):
for n in range(0,11):
for p in range(0,11):
if m + 2*n + 5*p == 10:
# display result if 1 * m + 2 * n + 5 * p == 10 when 1 * m + 2 * n + 5 * p == 10
print(str(m) + " * 1 + " , str(n) + " * 2 + ", str(p) + " * 5 " , " = 10 Euros" )
# if 1 * m + 2 * n + 5 * p == 10  if increment the number of ways to pay
numberOfWays = numberOfWays + 1
# display number of ways to paid
print("Finally, Number of ways is : " , numberOfWays)
``````

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 