1. Assume the program below starts with initial values of list1 =[7, 1, -1, 2], w = -2, x = 2, y = 12, z = -5. Indicate

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

1. Assume the program below starts with initial values of list1 =[7, 1, -1, 2], w = -2, x = 2, y = 12, z = -5. Indicate

Post by answerhappygod »

1.
Assume the program below starts with initial values of list1=[7, 1, -1, 2], w = -2, x = 2, y = 12, z = -5. Indicate the valuethat will be displayed after running the followingprogram:
while y > z:
z = z + x
y -=1
x += 1
print(x,y,z)
2.
Assume the program below starts with initial values of list1=[7, 1, -1, 2], w = -2, x = 2, y = 12, z = -5. Indicate the valuethat will be displayed after running the followingprogram:
while y > list1[2]:
y -=2
w = w+1
print(w,y,z)
3.
Assume the program below starts with initial values of list1=[7, 1, -1, 2], w = -2, x = 2, y = 12, z = -5. Indicate the valuethat will be displayed after running the followingprogram:
while True:
if w >= len(list1):
break
if list1[w] < 0:
w += 1
continue
else:
z = z + list1[w]
y += 1
w += 2
print(w,x,y,z)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply