Answers for "how to count number of letter in string python"

10

count characters in string python

>>> sentence = 'Mary had a little lamb'
>>> sentence.count('a')
4
Posted by: Guest on December-30-2020
0

giving number of letter in python

'''for i in range(1,100,50): #it means count from 1 to 100 and increase by 50
    print(i)'''
def find_short(s):
    li = list(s.split(" "))
    sc=[]
    for i in range(0,len(li)):
        sc.append(len(li[i]))
    return min(sc)


print(find_short("bitcoin take over the world maybe who knows perhaps"))
Posted by: Guest on February-26-2022

Code answers related to "how to count number of letter in string python"

Python Answers by Framework

Browse Popular Code Answers by Language