Write a for loop that iterates over a list of numbers num_list and prints the nu
ID: 3834838 • Letter: W
Question
Write a for loop that iterates over a list of numbers num_list and prints the numbers in the list whose square is divisible by 8. For example, if num_list is [2, 3, 4, 5, 6, 7, 8, 9], then the numbers 4 and 8 should be printed. Given list_a = [30, 1, 12, 14, 10, 0] How many elements are in list? What is the index of the first element in list_a? What is the index of the last element in list_a? What is list_a[2]? What is list_a[2]? Given list_1 = [3, 1, 2, 4. 0], what is the return value of each of the following statement? [x for x in list_1 if x > 1] [x * x for x in list_1] Using list comprehension, create the following lists [10, 8, 6, 4. 2] [0, 2, 4, 6, 8] What are list_x and list_y after the following lines of code? List_x = [1.43] List_y = [x for x in list_x] List_x[0] = 22Explanation / Answer
A)
for i in num_list:
if((i*i)%8==0:
print(i,' ')
B)
a. 6
b. 0
c. 5
d. 12
e. 10
C)
a. [3 2 4]
b. [9 1 4 16 0]
c. list1 = [x*2 for x in range(5,1)]
d. list1 = [x*2 for x in range(5)]
D)
list_x=[22 43]
list_y=[1 43]
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.