get all the letters in Python
How do I get all the letters in Python?
if we want to know how many letters are used in the string then we can take help of set ( ) function which will remove repetition of letters. let’s see example of it-
- x="this is our first line"
- s=set(())
- for i in range(len(x)):
- if x[i]==" ":
- pass
- else:
- s.add('%s'%x[i])
print(s)
Comments
Post a Comment