Skip to content

Commit db4d353

Browse files
committed
Added randomnumbers.py
1 parent bc62880 commit db4d353

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Created by: Brian Shortiss
2+
# Created on: 16 February 2020
3+
#
4+
# Create a program that puts 10 random numbers into a queue(list),
5+
# the program should then output all the values in the queue,
6+
# then take the numbers from the queue one at a time,
7+
# print it and the current numbers still in the queue.
8+
# (the command pop(0) takes the first element out of a list)
9+
10+
11+
import random
12+
queue = []
13+
numberOfNumbers = 10
14+
rangeTo = 100
15+
16+
for n in range(0, numberOfNumbers):
17+
queue.append(random.randint(0, rangeTo))
18+
print("queue is {}".format(queue))
19+
while len(queue) != 0:
20+
currentNumber = queue.pop(0)
21+
print("current Number is {} and the queue is {} ".format(
22+
currentNumber, queue))
23+
print("the queue is now empty")
24+
25+

0 commit comments

Comments
 (0)