Python - First Non-Repeating Character

preview_player
Показать описание
Also known as first unique character.
Рекомендации по теме
Комментарии
Автор

How about this one
St = "abgbca"
St =list(St)
For i in st:
If(st.count(i)==1):
print("first non repeating character is", i)
break


We can write this in function

kartiksood
Автор

Letters = list(word)

how about this 

letterCounter = Counter(Letters)
for letter in letterCounter:
if letterCounter[letter]==1:
return letter
return "-"

khwilehful
Автор

str = "abcdabcef"
print([x for x in str if str.count(x) ==1 ][0])
#This prints the first non repeating character i.e, d

yokeshchowdary
Автор

It might be a REAL GOOD IDEA to post the code

escapefelicity
join shbcf.ru