Skip to content

Instantly share code, notes, and snippets.

@rkalit
Created February 7, 2022 18:03
Show Gist options
  • Select an option

  • Save rkalit/2f148b861aae0376e5935367a3e0ed06 to your computer and use it in GitHub Desktop.

Select an option

Save rkalit/2f148b861aae0376e5935367a3e0ed06 to your computer and use it in GitHub Desktop.
DKatalis Solution for Q2
def t1Resource(x):
existCheckt1 = resource.count(x)
if existCheckt1 > 0:
T1.append(x)
resource.remove(x)
else:
res = min(resource)
T1.append(res)
resource.remove(res)
def t2Resource(y):
existCheckt1 = resource.count(y)
if existCheckt1 > 0:
T2.append(y)
resource.remove(y)
else:
res = min(resource)
T2.append(res)
resource.remove(res)
if __name__ == "__main__":
resource = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# or if you want custom length of resource
"""
nResource = int(input())
for i in range(nResource):
resource = [int(x) for x in input().split()]
"""
T1 = []
T2 = []
flag = True
while flag:
for i in range(len(resource)):
if len(resource) != 0:
t1 = int(input("Add resource for T1: "))
t1Resource(t1)
t2 = int(input("Add resource for T2: "))
t2Resource(t2)
else:
flag = False
break
break
print("T1 : {0}".format(T1))
print("T2 : {0}".format(T2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment