Purchase X13540


Statement
 

pdf   zip

thehtml

Dessign the function compra(llista, diners) which, given a list llista of prices of articles and a quantity of diners in euros, returns the number of articles that can be bought with this miney following the order in which they appear in the list. Whenever an article cannot be bought it will be left out. The solution must take into account that no article costs less than 10 euros.

Sample session
>>> compra([100, 125], 55)
0
>>> compra([50, 50, 30, 20, 40], 125)
3
>>> compra([200, 15, 15] + 100*[20], 30)
2
>>> compra([50, 10, 10, 10, 10, 10, 10, 80], 60)
2
Information
Author
Language
English
Translator
Original language
Catalan
Other languages
Catalan Spanish
Official solutions
Python
User solutions
Python