mirror of
https://github.com/onyx-and-iris/grokking-algorithms.git
synced 2024-11-15 17:30:52 +00:00
add greatest value with iphone
This commit is contained in:
parent
24c2a1984f
commit
d6d918976e
@ -48,11 +48,26 @@ def format_and_print(table):
|
|||||||
table[0][0] = None
|
table[0][0] = None
|
||||||
|
|
||||||
# print tabularised 2D array
|
# print tabularised 2D array
|
||||||
|
logger.info([item.name for item in items])
|
||||||
logger.info(tabulate(table, tablefmt="pretty"))
|
logger.info(tabulate(table, tablefmt="pretty"))
|
||||||
|
|
||||||
|
|
||||||
|
# Where items = Guitar + Stereo + Laptop
|
||||||
items = [Item("Guitar", 1500, 1), Item("Stereo", 3000, 4), Item("Laptop", 2000, 3)]
|
items = [Item("Guitar", 1500, 1), Item("Stereo", 3000, 4), Item("Laptop", 2000, 3)]
|
||||||
W = 4
|
W = 4
|
||||||
greatest_value = dynamic(items, len(items))
|
greatest_value = dynamic(items, len(items))
|
||||||
|
|
||||||
print(greatest_value)
|
print(f"Greatest value: {greatest_value}")
|
||||||
|
|
||||||
|
|
||||||
|
# Where items = Guitar + Stereo + Laptop + Iphone
|
||||||
|
items = [
|
||||||
|
Item("Guitar", 1500, 1),
|
||||||
|
Item("Stereo", 3000, 4),
|
||||||
|
Item("Laptop", 2000, 3),
|
||||||
|
Item("Iphone", 2000, 1),
|
||||||
|
]
|
||||||
|
W = 4
|
||||||
|
greatest_value_with_iphone = dynamic(items, len(items))
|
||||||
|
|
||||||
|
print(f"Greatest value: {greatest_value_with_iphone}")
|
||||||
|
Loading…
Reference in New Issue
Block a user