Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a python code for these problems 1. Write a python function which calculat

ID: 3756052 • Letter: W

Question

Write a python code for these problems

1. Write a python function which calculates the product of all integers in a list. Write additional statements that calls this function and passes the list - [3,4,5,6,5.5,10.1234].

2. Create tuples with the values – informatics, fall, semester, I501, 2017, 74, students and print each value using for loop.

for the given lists, show the value equality, object equality and print id for each of the lists.

Write a python program which does the following:

a. add items in list3 to list2

b. Remove saptarshi from list3

c. Insert sam at 5th position of the 3 lists combined

d. Sort the elements of the combined list in ascending order

Explanation / Answer

1) def product(lst): result = 1 for num in lst: result *= num return result print(product([3, 4, 5, 6, 5.5, 10.1234])) 2) tuples = ('informatics', 'fall', 'semester', 'I501', '2017', '74', 'students') for item in tuples: print(item) 3) l1= ['student','python', 'script'] l2 =['student','java','program'] # value equality print(l1 == l2) # object equality print(l1 is l2) # print id print(id(l1)) print(id(l2)) 4) # a list2 += list3 # b del list3[0] # c (list1 + list2 + list3).insert(5, 'sam') # d (list1 + list2 + list3).sort()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote