mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-23 09:38:27 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
ff961fa04a
commit
72868008ad
|
@ -1,4 +1,5 @@
|
||||||
from doctest import testmod
|
from doctest import testmod
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Test cases:
|
Test cases:
|
||||||
Do you want to enter your denominations ? (Y/N) :N
|
Do you want to enter your denominations ? (Y/N) :N
|
||||||
|
@ -40,6 +41,8 @@ Enter the change you want to make: 456
|
||||||
Following is minimal change for 456 :
|
Following is minimal change for 456 :
|
||||||
100 100 100 100 5 5 5 5 5 5 5 5 5 5 5 1
|
100 100 100 100 5 5 5 5 5 5 5 5 5 5 5 1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def find_minimum_change(denominations: list[int], value: int) -> list[int]:
|
def find_minimum_change(denominations: list[int], value: int) -> list[int]:
|
||||||
"""
|
"""
|
||||||
Find the minimum change from the given denominations and value.
|
Find the minimum change from the given denominations and value.
|
||||||
|
@ -87,12 +90,19 @@ if __name__ == "__main__":
|
||||||
denominations = []
|
denominations = []
|
||||||
value = 0
|
value = 0
|
||||||
|
|
||||||
if input("Do you want to enter your denominations ? (y/n): ").strip().lower() == "y":
|
if (
|
||||||
|
input("Do you want to enter your denominations ? (y/n): ").strip().lower()
|
||||||
|
== "y"
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
n = int(input("Enter the number of denominations you want to add: ").strip())
|
n = int(
|
||||||
|
input("Enter the number of denominations you want to add: ").strip()
|
||||||
|
)
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
denominations.append(int(input(f"Denomination {i + 1}: ").strip()))
|
denominations.append(int(input(f"Denomination {i + 1}: ").strip()))
|
||||||
value = int(input("Enter the change you want to make in Indian Currency: ").strip())
|
value = int(
|
||||||
|
input("Enter the change you want to make in Indian Currency: ").strip()
|
||||||
|
)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Invalid input. Please enter valid numbers.")
|
print("Invalid input. Please enter valid numbers.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user