QUIZ 1-无代写
时间:2023-09-26
QUIZ 1
COMP9021 PRINCIPLES OF PROGRAMMING
$ python3 quiz_2.py
Enter a permutation of 0, ..., n for some n >= 0: 7 2 6 4 3 5 1 0
Enter two integers, the second one between 0 and 10: 0 5
Here is your list:
[7, 2, 6, 4, 3, 5, 1, 0]
Here is my list:
[2, 1, 0, 4, 3]
Removing again and again the currently largest
or smallest element in your list for as long as
it currently starts or ends the list, we get:
[]
That's how to travel in my list:
0
1--
2--
--------3
4--
$ python3 quiz_2.py
Enter a permutation of 0, ..., n for some n >= 0: 1 0 3 2
Enter two integers, the second one between 0 and 10: 1 7
Here is your list:
[1, 0, 3, 2]
Here is my list:
[3, 6, 5, 2, 0, 4, 1]
Removing again and again the currently largest
or smallest element in your list for as long as
it currently starts or ends the list, we get:
[1, 0, 3, 2]
That's how to travel in my list:
0
----1
2------
3------
----------4
5------
6--
Date: Trimester 3, 2023.
2 COMP9021 PRINCIPLES OF PROGRAMMING
$ python3 quiz_2.py
Enter a permutation of 0, ..., n for some n >= 0: 10 8 2 3 6 4 7 5 1 9 0
Enter two integers, the second one between 0 and 10: 3 10
Here is your list:
[10, 8, 2, 3, 6, 4, 7, 5, 1, 9, 0]
Here is my list:
[1, 5, 6, 0, 9, 4, 7, 2, 8, 3]
Removing again and again the currently largest
or smallest element in your list for as long as
it currently starts or ends the list, we get:
[6, 4, 7, 5]
That's how to travel in my list:
0
1------
--------------2
----3
4--------
5--------
--6
--------7
----8
9--------