Question

Complete the get_mid_letter() function which is passed a list of strings as a parameter. The function returns a string made up of the concatenation of the middle letter of each word from the parameter list. The string returned by the function should be in lowercase characters. If the parameter list is an empty list, the function should return an empty string For example Test Result print(1., get mid_letterJess, Cain, Amity, Raeann])) 1. siia Answer (penalty regime: 0 %) 1 -Idef get_mid_letter(a_list): Check

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def get_mid_letter(lst):
    result = ""
    for x in lst:
        result += x[len(x)//2]
    return result.lower()

Add a comment
Know the answer?
Add Answer to:
Complete the get_mid_letter() function which is passed a list of strings as a parameter. The function...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Define the get_list_of_lists() function which is passed a list of strings as a parameter. An example...

    Define the get_list_of_lists() function which is passed a list of strings as a parameter. An example parameter list is: ["4 3 1 12 2 12 3 12 4 3", "4 3 1 12 2 12 3 12 4 3", "4 3 1 12 2 6"] The function returns a list of lists of tuples. For each element of the parameter list, e.g., "4 3 1 12 2 12" the function creates a list of tuples, e.g., [("4", 3), ("1", 12),...

  • I need help for this assignment. Thank you!! # 5555555555555555555555555555555555555555555555555 # Returns the longest word (which has six or more # characters and contains the letter, e) from # the...

    I need help for this assignment. Thank you!! # 5555555555555555555555555555555555555555555555555 # Returns the longest word (which has six or more # characters and contains the letter, e) from # the parameter list - 4 marks Os Define the get_longest_e_word() function which is passed a list of strings as a parameter. The function returns the word in the list which has the most characters (i.e., the longest word) BUT only words which have 6 or more characters and contain the letter...

  • Basic Python code needed Define the get_lines_from_file) function which is passed a filename as a parameter....

    Basic Python code needed Define the get_lines_from_file) function which is passed a filename as a parameter. The function reads the information from the file (corresponding to the filename parameter) and returns a list of strings where each element of the returned list corresponds to one line of the file. The list of strings which is returned by the function should not contain any newline characters. For example, if the file contains the text: 10 440 240 4 42 4 42...

  • Define a function called get_n_largest(numbers, n) which takes a list of integers and a value n...

    Define a function called get_n_largest(numbers, n) which takes a list of integers and a value n as parameters and returns a NEW list which contains the n largest values in the parameter list. The values in the returned list should be in increasing order. The returned list must always be of length n. If the number of values in the original list is less than n, the value None should be repeated at the end of the returned list to...

  • Write a python function alt which takes a list of strings myList as a parameter. alt...

    Write a python function alt which takes a list of strings myList as a parameter. alt then returns two strings s1 and s2 as a tuple (s1, s2). Here s1 is the concatenation of the strings in myList in even index positions, and s2 is the concatenation of the strings in myList in odd index positions. (List starts at index 0) For example, if myList = [‘My’, ‘kingdom’, ‘for’, ‘a’ , ‘horse’], then s1 = ‘Myforhorse’ and s2 = ‘kingdoma’.

  • Write a void function called FlipString. It should have 1 string parameter passed by reference. It...

    Write a void function called FlipString. It should have 1 string parameter passed by reference. It should replace each capital letter with its lowercase letter, and each lowercase letter with its capital letter. Use the functions toUpper() and toLower() to help you.

  • Write a function valid_integers(strings) that takes a list of strings as a parameter and returns a...

    Write a function valid_integers(strings) that takes a list of strings as a parameter and returns a list of the integers that can be obtained by converting the strings to integers using an expression like int(string). Strings which cannot be converted in this way are ignored. Hint: the statement pass is a statement that does nothing when executed. For example: Test Result strings = ['123', '-39', '+45', 'x', 'COSC121', '123+', '12-3'] print(valid_integers(strings)) [123, -39, 45]

  • Define the is_a_valid_date() function which is passed a string as a parameter. The function returns a...

    Define the is_a_valid_date() function which is passed a string as a parameter. The function returns a boolean indicating whether the parameter string is a valid date or not. The first two lines of the function are: month_names = ["January", "February", "March","April", "May", "June", "July", "August", "September", days_in_month = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) where month_names is a list of valid month names, and days_in_month is a list which contains the maximum day number...

  • Define the is_a_valid_date() function which is passed a string as a parameter. The function returns a...

    Define the is_a_valid_date() function which is passed a string as a parameter. The function returns a boolean indicating whether the parameter string is a valid date or not. The first two lines of the function are: month_names = ["January", "February", "March", "April", "May", "June", "July", "August", "September", days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] where month_names is a list of valid month names, and days_in_month is a list which contains the maximum day...

  • For this task you're going to write a function that joins strings from a list. The function calle...

    I need help with this python programming assignment please double check the indentations For this task you're going to write a function that joins strings from a list. The function called join ) has one formal parameter and one optional parameter. Recall that an optional parameter is like end or sep in the print( function. You don't have to use it because there's a default value. For the print () function, e.g., \'n' (newline) is the default value for end....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT