Answers for "how to get distinct letters from a string in python"

0

python count distinct letters

string = 'aabbcd'
unique = []
for char in string[::]:
    if char not in unique:
        unique.append(char)
print(len(unique))
Posted by: Guest on May-03-2021
0

how to get all distinct substrings in a string python

def substr(string):
    j=1
    a=set()
    while True:
        for i in range(len(string)-j+1):
            a.add(string[i:i+j])
        if j==len(string):
            break
        j+=1
    return a
Posted by: Guest on April-12-2021

Code answers related to "how to get distinct letters from a string in python"

Python Answers by Framework

Browse Popular Code Answers by Language