a = {"Joe": {"AAPL": 5, "AMZN": 2}, "Bill": {"AAPL": 2, "AMZN": 5}}
B = {"AAPL": 227, "AMZN": 1721, "NFLX": 267, "TSLA": 244, "FB": 179}
total = 0
largest = 0
for x in a:
for w in a[x]:
total += a[x][w] * B[w]
a[x] = total
if total > largest:
largest = total
print("{} will have ${}".format(x, total))
for x in a:
if a[x] == largest:
print("{} will get the most value".format(x))
I hope this helps!