Question: Write a Python program to do the following: (A) Use the range function to generate this sequence of integers: 5, 9, 13, 17 and 21.
Write a Python program to do the following:
(A) Use the range function to generate this sequence of integers: 5, 9, 13, 17 and 21. Save the numbers in a list. Display the list.
(B) Use a for loop to display each element in a separate line.
(C) Use the range function to generate this sequence of integers: 26, 19, 12 and 5. Save the numbers in a list. Display the list.
(D) Use a for loop to calculate the total of the elements in the second list. Display the total.
The following is the expected output. There is no user input in this program.
First list: [5, 9, 13, 17, 21]
Elements in the first list:
5
9
13
17
21
Second list: [26, 19, 12, 5]
Total of the elements in the second list: 62
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
