def find_longest_length(my_list):
max_length = len(my_list[0])
temp = my_list[0]
for element in my_list:
if(len(element) > max_length):
max_length = len(element)
temp = element
return max_length
my_list = ["Vijay", "Rajesh", "Gangaraju", "Rajagopal"]
print("The list is :")
print(my_list)
print("The result is :")
print(find_longest_length(my_list))
def remove_nth(str, index):
new_str = str[:index] + str[index+1:]
return new_str
print(remove_nth('Printss',6))
print(remove_nth('Scdea',4))
# initializing string
test_string = "welcome to the Scde training"
# initializing split word
spl_word = 'S'
# using split()
# Get String after substring occurrence
res = test_string.split(spl_word, 1)
# print result
print(res[1])
def sortStringInLexo(string):
words = string.split()
words.sort()
for word in words:
print( word )
if __name__ == '__main__':
string = "welcome to the Scde training"
sortStringInLexo(string)
# remove spaces using remove function
def remove(string_input):
return "".join(string_input.split())
# Driver Program
string_input= ' welcome to the Scde training'
print(remove(string_input))