Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (5pts) Use the following sequence for the next three questions: seq = ([1,2,3], 4, (1, 2, 3, (John, Alan]], cat) What is the value

image text in transcribed
1. (5pts) Use the following sequence for the next three questions: seq = ([1,2,3], 4, ("1", "2", "3", ("John", "Alan"]], "cat") What is the value of each expression? seq[1] seq[-2)(3)(1)(-1) len(seq) seq[2][2] What is the type of each expression? seq[2] seq[@](1:) How do you access the following list elements using bracket notation? "John" What is the result of the expression? "3" in seg seq[@][0] + seq[1] 2. (3pts) Complete the function that returns the ratio between the sum of the negative elements and the product of the negative elements of a list. def ratio_sum_product (num_list): = (1, -2, 3, -4, 0] would return -0.75 #(-2+ -) / (-2. -4) 3. (2 pts) Write the output of the following program Output: 1st = [1,2,3,4] for i in range(len(1st)): for j in Ist[i:]: print(j, enda',') print()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions