Write a Python function to find all string which are greater than given length k


Topic: Write a Python function to find all string which are greater than given length k

Solution

def string_k(k, str): 
    
    string = [] 
    text = str.split(" ") 
    for x in text: 
        if len(x) > k: 
            
            string.append(x) 
    return string 
k = 3
str1 ="geek for geeks"
print(string_k(k, str1)) 



List all Python Programs