-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloopList.py
More file actions
53 lines (36 loc) · 1.05 KB
/
loopList.py
File metadata and controls
53 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import random
lotteryNumbers= []
lotteryNumbers.append(random.randint(1,69))
lotteryNumbers.append(random.randint(1,69))
lotteryNumbers.append(random.randint(1,69))
lotteryNumbers.append(random.randint(1,69))
lotteryNumbers.append(random.randint(1,69))
lotteryNumbers.append(random.randint(1,69))
'''
print(lotteryNumbers)
'''
'''
# How do you print all the indexes
for i in range(0,len(lotteryNumbers)):
print(lotteryNumbers[i]) # print all the indexes
'''
# Modify the list add the value 5 to every value in the array
'''
print("Before: ", lotteryNumbers)
# update all the elements in the list using the for loop
for i in range(0,len(lotteryNumbers)):
lotteryNumbers[i]= lotteryNumbers[i]+5
print("After: ",lotteryNumbers)
'''
'''
Exercises:
create a loop and:
print all the values in the list divided by 2
print all the squares of the numbers in the list
'''
'''
#How do you display any value in the array greater than 5
for i in range(0,len(lotteryNumbers)):
if lotteryNumbers[i] >25:
print(lotteryNumbers[i])
'''