Write a python program to extract two list slices of a given list of numbers. Display and print the sum of elements of first list slice which contain every other element between index 5 to 15. Programs should also display the average of second sliced list which contains every fourth elements of list. The list contains 20 elements.
Answers
Answered by
1
Answer:
List is a collection in python. It is similar to the array of most languages. We often need 'list' in our programs. Imagine you are writing a program to store marks of every student in a class of 50. Taking 50 different variables is not a good option and here comes list in action.
Answered by
1
Answer:
As you can see that type([]) is giving us list. This means that '[]' is a list as mentioned above.
Index → Every member in a list is known by its position, starting from 0. For example, in the list [3,4,2,5], index will start from 0. So, index of 3 is 0, 4 is 1, 2 is 2 and 5 is 3. Thus, the index started from 0 and went up to 3.
element 2 3 15 8 48 13
index 0 1 2 3 4 5
Similar questions