I have a set containing names that begin with either A or with B. I want to separate the names into two sets, one containing names beginning with A and another beginning with B. Can somebody tell me the ways of solving this?
Here is my code
a = set()
b = set()
names = {'anand', 'bianca', 'benjamin', 'ayesha', 'brian', 'adarsh'}
print(names)
for ele in names:
if ele == "a":
a.add(ele)
else:
b.add(ele)
print("Set a contains : ", a)
print("Set b contains : ", b)