MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / getMoneySpent

Function getMoneySpent

Hackerrank_problems/ElectronicShop/solution.py:8–16  ·  view source on GitHub ↗
(keyboards, drives, b)

Source from the content-addressed store, hash-verified

6#
7#You will get the money spent between the keyboard and the usb and sum it if it is less than the budget it will return the price spent
8def getMoneySpent(keyboards, drives, b):
9 spend = -1
10 #Check each cost of each keyboard with that of each usb will sum them until some result is less than the budget we have
11 for key in keyboards:
12 for d in drives:
13 if key + d <=b:
14 spend = max(spend, key + d)
15
16 return spend
17
18#Get the input from the user the first line will get the max money to spend, the model of keyboard and the model of usb
19if __name__ == '__main__':

Callers 1

solution.pyFile · 0.70

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected