science facts and news

Monday, July 5, 2021

Python program to return first non-repeating letter - Codewars solution.

def first_non_repeating_letter(string):
    low_str = []
    for i in string:
        low_str.append(i.lower())
    for i in string:
        if low_str.count(i.lower()) == 1:
            return i
    return ''


print(first_non_repeating_letter('sTreSS'))

No comments:

Post a Comment

About Me

Kohalpur, Banke, Nepal
Hi, I'm Roshan , a student just trying to explore the world of programming