def ReplaceAllInList(list, lookupvalue, replacewith):
return [(replacewith if v == lookupvalue else v) for v in list]
a = ['aaa', 'bb', 'bb']
a = ReplaceAllInList(list= a, lookupvalue= 'bb', replacewith= 'cc')
print(a) # output --> ['aaa', 'cc', 'cc']