Mar-25-2020, 05:27 PM
def similiar():
n=input()
for name,rating in ratingsdict.items():
if name == n:
return(rating)
for key in ratingsdict():
print(sum(ratingsdict[key]*rating for ratingsdict[key], rating in zip(ratingsdict[key], ratings)))
similiar()
I have created a dictionary already and I am trying to do the dot product on all of the lists within the dictionary with another list that is in rating but I am unable to achieve this.
n=input()
for name,rating in ratingsdict.items():
if name == n:
return(rating)
for key in ratingsdict():
print(sum(ratingsdict[key]*rating for ratingsdict[key], rating in zip(ratingsdict[key], ratings)))
similiar()
I have created a dictionary already and I am trying to do the dot product on all of the lists within the dictionary with another list that is in rating but I am unable to achieve this.