7
1
watching
2,397
views

# 1.Create a list that contains 10 successive integers starting with the value in the variable `start`. For example, if `start` is 7, the resulting list should be [7, 8, 9, 10, 11, 12, 13, 14, 15, 16]. Store the list in a variable named `my_list`. Assume that the value of `start` has already been set.   2.Create a list that is made up of the first half of the elements of a list called `original_list`. Store the new list in a variable called `half_list`. Assume that the original list has already been initialized and contains an even number of elements.     3. Write a predicate function called `same_ends` that accepts a list of integers and an integer (n) as arguments. Return `True` if the first n numbers in the list are the same as the last n numbers in the list, and `False` otherwise. For example, if the list was [1, 2, 3, 4, 99, 1, 2, 3, 4], the function would return `True` if n is 4 and `False` if n is 3. Assume that n is between 1 and the length of the list, inclusive.   4.Write a function called `highest_values` that accepts as arguments a list of numeric values and a single integer (n). The function should return a list made up of the largest n values from the argument list in order from lowest to highest. For example, if the argument list is [46, 82, 25, 61, 70, 33, 54] and n is 3, the return value should be [61, 70, 82]. Assume that the argument list contains at least n elements.   5.Assume that a list of integers stored in a variable named `original` contains exactly two elements that are zero. Write code that creates a separate list that contains the elements from `original` that are between the two zeros. Do not include the zeros in the new list. Store the list in a variable named `between_zeros`.   6. Write a function called `price_range` that accepts a list of floating-point numbers representing prices as an argument and returns the the difference between the highest price and the lowest price. Do NOT use the built-in functions `max` or `min` in your solution. Assume that all prices are positive values and that none of them exceed 10,000.00.   7. Write a function called `count_vowels` that accepts a string argument that represents a word and returns the number of vowels that are in the word. The vowels are A, E, I, O, and U (ignore the 'sometimes Y' rule). Count both uppercase and lowercase vowels.   8. Assume that the variable `table` holds a two-dimensional list of integers. Write code that computes the sum of all elements in the table, assigning the result to the variable `table_sum`.

Get 1 free homework help answer.