1. Assume the program below starts with initial values of list1 = [7, -2, -3, 2], x = 0, y = 2, z = 0. Indicate the valu

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, -2, -3, 2], x = 0, y = 2, z = 0. Indicate the valu

Post by answerhappygod »

1.
Assume the program below starts with initial values of list1 =[7, -2, -3, 2], x = 0, y = 2, z = 0. Indicate the value that willbe displayed after running the following program:
if list1[0] >= y and list1[1] != x:
print('condition satisfied')
else:
print('condition NOT satisfied')
2.
Assume the program below starts with initial values of list1 =[7, -2, -3, 2], x = 0, y = 2, z = 0. Indicate the value that willbe displayed after running the following program:
if x and y and not z:
print('first condition satisfied')
elif x and y or z:
print('second condition satisfied')
else:
print('neither condition satisfied')
3.
Assume the program below starts with initial values of list1 =[7, -2, -3, 2], x = 0, y = 2, z = 0. Indicate the value that willbe displayed after running the following program:
if list1[0] < 0:
print(list1[0], 'is the first negativenumber.')
elif list1[1] < 0:
print(list1[1], 'is the first negativenumber.')
elif list1[2] < 0:
print(list1[2], 'is the first negativenumber.')
elif list1[3] < 0:
print(list1[3], 'is the first negativenumber.')
else:
print('list1 has no negative numbers')
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply