Solution: Separate the Names in a Set into Two Sets
Learn how to separate the names given in a set into two sets.
We'll cover the following...
The solution to the problem of separating the names given in a set into two sets is given below.
Solution
Press + to interact
# Split given set into two setsst = {'Amelia', 'Ava', 'Alexander', 'Avery', 'Asher', 'Bam', 'Bob', 'Bali', 'Bela', 'Boni'}t = set( )s = set( )for item in st :if item.startswith('A') :t.add(item)elif item.startswith('B') :s.add(item)print(t)print(s)
...