PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Challenge by Zygarde
# Problem: Find the First Non-Repeating Character
# Write a function that takes a string and returns the first character that appears only once.
# If all characters repeat, return an empty string.
# Solve:
text = input()
def first_unique_char(text):
# Case in-sensitive search
lower_text = text.lower()
for char in text:
# Preserve the letter's case in the output
if lower_text.count(char.lower()) == 1:
return char
return ""
print(first_unique_char(text))
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run