This program I created asks the user for three values, and tells the user if he entered 1, 2 or 3 unique strings. But I feel it looks very repetitive:
def num_unique(v1, v2, v3):
vlist = []
if v1 not in vlist:
vlist.append(v1)
if v2 not in vlist:
vlist.append(v2)
if v3 not in vlist:
vlist.append(v3)
return len(vlist)
How can I group the arguments together and loop through them rather than listing them out 1 by 1?
Grateful for all the help, thanks!