9.18. Write Code Questions

Write a function add_to_new_list that takes in a list of strings, lst, as a parameter and creates a new list with the length of lst and the first element of lst three times. For example, add_to_new_list(["1","2","3"]) would return [3, '111'].

Write a function add_to_new_list that takes in a list of strings, lst, as a parameter and creates a new list with the length of lst and the first element of lst three times. For example, add_to_new_list(["1","2","3"]) would return [3, '111'].

Loading a dynamic question ...
Selecting from: list_writeItemsq_v2_ac, list_writeItemsq_v2_pp

Write a function average that takes in a list of integers, aList, as a parameter and returns the average of all of the integers, rounded to one decimal place. For example, average([99, 100, 74, 63, 100, 100]) would return 89.3.

Write a function average that takes in a list of integers, aList, as a parameter and returns the average of all of the integers, rounded to one decimal place. For example, average([99, 100, 74, 63, 100, 100]) would return 89.33.

Loading a dynamic question ...
Selecting from: list_write23_ac, list_write23_pp

Write a function capitalize that takes in a list of lists of strings, lst, and makes the first letter of each element capitalized and adds it to a new list and returns that new list. For example, capitalize([["hi"],["hello", "hey"]]) would return ['Hi', 'Hello', 'Hey'].

Write a function capitalize that takes in a list of lists of strings, lst, and makes the first letter of each element capitalized and adds it to a new list and returns that new list. For example, capitalize([["hi"],["hello", "hey"]]) would return ['Hi', 'Hello', 'Hey'].

Loading a dynamic question ...
Selecting from: list_write5_ac, list_write5_pp

Write a function chop that takes a list, lst, and modifies it, removing the first and last elements. For example, chop([1,2,3,4,5] should return [2,3,4].

Before you keep reading...

Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.

Write a function chop that takes a list, lst, and modifies it, removing the first and last elements. For example, chop([1,2,3,4,5] should return [2,3,4].

Loading a dynamic question ...
Selecting from: list_writeReverse_ac, list_writeReverse_pp

Write a function sumUntilEven that takes in one parameter, lst, and returns the sum of all the elements in the lst up to but not including the first even number. For example, sumUntilEven([1,2,3,4,5] should return 1 and sumUntilEven([1,3,5,7,9] should return 25.

Write a function called sumUntilEven that takes in one parameter, lst, and returns the sum of all the elements in the lst up to but not including the first even number. For example, sumUntilEven([1,2,3,4,5] should return 1 and sumUntilEven([1,3,5,7,9] should return 25.

Loading a dynamic question ...
Selecting from: list_sortByLen_ac, list_sortByLen_pp

Write a function combine(names, ages) that takes in two lists, names and ages and returns a list of strings in the format "Name: name, age: age". For example, combine(["Claire", "Jennifer"],[23, 19]) would return ["Name: Claire, age: 23", "Name: Jennfier, age: 19"].

You have attempted 1 of 17 activities on this page