-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.py
More file actions
30 lines (22 loc) · 689 Bytes
/
array.py
File metadata and controls
30 lines (22 loc) · 689 Bytes
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
#!/usr/bin/env python3
# Created by: Abdul Basit
# Created on: Jan 2022
# This program calculates average of 10 random numbers
import random
def main():
# this function displays 10 random number with the array
my_numbers = []
average = 0
for loop_counter in range(0, 10):
a_number = random.randint(1, 100)
my_numbers.append(a_number)
average = average + my_numbers[loop_counter]
print(
"The random number is: {0} ".format(my_numbers[loop_counter]), end="" + "\n"
)
print("")
average = average / 10
print("The average is {0}".format(average))
print("\nDone.")
if __name__ == "__main__":
main()