Need help with Python Programming Questions about output

User Generated

nnebaw9999

Computer Science

Description

Q30.pdf

Could someone please give me a detailed explanation of Question 30 (see pdf)? You can disregard Question 29.

Unformatted Attachment Preview

CS177 Spring 2015 Final exam - Page 18 of 29 29. What is the output of the following Python program? myList1 = l i s t ( range ( 6 ) ) ⇤ 2 myList2 = l i s t ( range ( 5 , 8 ) ) ⇤ 2 mySet = set ( myList1 ) set ( myList2 ) print ( mySet ) A. {0, 1, 2, 3, 4} B. {1, 2, 3, 4} C. {0, 2, 4, 6} D. [0, 2, 5, 7] E. [0, 2, 6, 8] 30. What is the output of the following Python program? myDict1 = {} myDict2 = {} for i in range ( 1 0 ) : myDict1 [ i ] = i ⇤3 + 2 myDict2 [ i ] = i ⇤4 1 temp = 0 for j in range ( 4 , 7 ) : temp += myDict1 [ j ] + myDict2 [ j ] print ( temp ) A. 62 B. 80 C. 104 D. 108 E. 120 Fri 05/08 7:00p - 9:00p
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer


Anonymous
Really helped me to better understand my coursework. Super recommended.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags