Answer:
def nonRepeatings(s3):
non = []
letter_dictionary = {}
for l in s3:
if l in letter_dictionary:
letter_dictionary[l] += 1
else:
letter_dictionary[l] = 1
for c in letter_dictionary:
if letter_dictionary[c] == 1:
non.append(c)
return non
Explanation:
- Declare an empty list and a dictionary
- Initialize a for loop that iterates through the given string s3
Inside the loop:
- If a character in the string is in the dictionary, increment its count by 1. If not, add it to the dictionary
When the first loop is done, initialize another for loop that iterates through the dictionary.
- Inside the loop, check if any character has a value of 1, put it to the non.
- Finally, return the non