File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
labs/Topic05-datastructures Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments