4

讲解 COMP9021 QUIZ 1

 3 years ago
source link: https://segmentfault.com/a/1190000040166183
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

讲解 COMP9021 QUIZ 1

发布于 3 分钟前

QUIZ 1
COMP9021 PRINCIPLES OF PROGRAMMING
$ python3 quiz_1.py
Enter two integers, the second one being strictly positive: 0 1
Here are the generated widths:
[7]
Here are the generated symbols:
['&']
Here are the generated repetitions:
[1]
Here is the input as a pattern:
7&1
Here is the input as a dictionary:
(7, 1): '&'
Here is the input as an amazing picture:
|&&&&&&&|
$ python3 quiz_1.py
Enter two integers, the second one being strictly positive: 10 2
Here are the generated widths:
[1, 1]
Here are the generated symbols:
['&', '$']
Here are the generated repetitions:
[8, 8]
Here is the input as a pattern:
1&81$8
Due to identical pairs of numbers, the input cannot be represented as a dictionary.
Here is the input as an amazing picture:
|&|&|&|&|&|&|&|&|
|$|$|$|$|$|$|$|$|
Date: Trimester 2, 2021.
2 COMP9021 PRINCIPLES OF PROGRAMMING
$ python3 quiz_1.py
Enter two integers, the second one being strictly positive: 20 3
Here are the generated widths:
[3, 6, 1]
Here are the generated symbols:
['%', '+', '&']
Here are the generated repetitions:
[2, 3, 7]
Here is the input as a pattern:
3%26+31&7
Here is the input as a dictionary:
(3, 2): '%', (6, 3): '+', (1, 7): '&'
Here is the input as an amazing picture:
|%%%|%%%|
|++++++|++++++|++++++|
|&|&|&|&|&|&|&|
$ python3 quiz_1.py
Enter two integers, the second one being strictly positive: 50 4
Here are the generated widths:
[8, 4, 2, 4]
Here are the generated symbols:
['%', '*', '-', '-']
Here are the generated repetitions:
[6, 6, 6, 2]
Here is the input as a pattern:
8%64*62-64-2
Here is the input as a dictionary:
(8, 6): '%', (4, 6): '*', (2, 6): '-', (4, 2): '-'
Here is the input as an amazing picture:
|%%%%%%%%|%%%%%%%%|%%%%%%%%|%%%%%%%%|%%%%%%%%|%%%%%%%%|

************

QUIZ 1 3
$ python3 quiz_1.py
Enter two integers, the second one being strictly positive: 100 5
Here are the generated widths:
[3, 3, 7, 9, 8]
Here are the generated symbols:
['*', '&', '-', '@', '%']
Here are the generated repetitions:
[8, 6, 2, 2, 1]
Here is the input as a pattern:
3*83&67-29@28%1
Here is the input as a dictionary:
(3, 8): '*', (3, 6): '&', (7, 2): '-', (9, 2): '@', (8, 1): '%'
Here is the input as an amazing picture:
4 COMP9021 PRINCIPLES OF PROGRAMMING
$ python3 quiz_1.py
Enter two integers, the second one being strictly positive: 200 10
Here are the generated widths:
[1, 3, 1, 1, 8, 4, 7, 8, 8, 3]
Here are the generated symbols:
['$', '+', '', '', '*', '@', '^', '&', '%', '#']
Here are the generated repetitions:
[1, 5, 3, 5, 4, 5, 2, 4, 2, 8]
Here is the input as a pattern:
1$13+513158*44@57^28&48%23#8
Due to identical pairs of numbers, the input cannot be represented as a dictionary.
Here is the input as an amazing picture:

WX:codehelp


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK