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')
1. Assume the program below starts with initial values of list1 = [7, -2, -3, 2], x = 0, y = 2, z = 0. Indicate the valu
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am