代做COMP9021、代写Python设计编程
COMP9021 Principles of Programming
Term 1, 2024
Coding Quiz 5
Worth 4 marks and due Week 8 Thursday @ 9pm
Description
You are provided with a stub in which you need to insert your code where indicated without doing
any changes to the existing code to complete the task.
Given the value of seed and density, the provided code randomly fills an array (or grid) of size
10 x 10 with 0s and 1s. Your task is to determine and output the size of the largest parallelogram
with horizontal sides. A parallelogram consists of a line with at least 2 consecutive 1s, with below
at least one line with the same number of consecutive 1s, all those lines being aligned vertically in
which case the parallelogram is actually a rectangle, for instance:
1 1 1
1 1 1
1 1 1
1 1 1
or consecutive lines move to the left by one position, for instance:
1 1 1
1 1 1
1 1 1
1 1 1
or consecutive lines move to the right by one position, e.g.
1 1 1
1 1 1
1 1 1
1 1 1
The size is the number of 1s in the parallelogram. In the above examples, the size is 12.
See test cases below for more examples.
2
Due Date and Submission
Quiz 5 is due Week 8 Thursday 4 April 2024 @ 9.00pm (Sydney time).
Note that late submission with 5% penalty per day is allowed up to 3 days from the due date, that
is, any late submission after Week 7 Sunday 7 April 2024 @ 9pm will be discarded.
Make sure not to change the filename quiz_5.py while submitting by clicking on [Mark] button
in Ed. It is your responsibility to check that your submission did go through properly using
Submissions link in Ed otherwise your mark will be zero for Quiz 5.
Test Cases
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 1
Here is the grid that has been generated:
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
There is no parallelogram with horizontal sides.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 2
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 0
0 1 0 0 1 0 1 0 0 1
1 0 1 1 1 0 1 1 1 0
0 0 1 0 1 1 0 1 0 0
0 0 0 1 0 0 1 1 0 1
1 0 1 0 1 1 0 1 1 0
1 0 0 0 0 1 1 0 0 0
0 0 0 1 1 0 0 1 1 1
1 1 0 1 0 1 1 0 0 0
1 0 0 1 0 1 1 0 0 0
The largest parallelogram with horizontal sides has a size of 4.
3
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 3
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 0 1 0 1 0 0 1 1 1
1 1 0 1 0 1 0 1 1 1
1 0 1 1 1 1 1 0 1 1
1 1 1 0 1 0 0 1 1 1
1 1 0 1 1 1 0 1 1 1
0 0 1 0 0 0 1 1 0 0
1 1 1 0 1 1 1 1 0 1
1 1 0 1 1 1 1 1 0 1
1 1 1 0 1 0 0 0 0 1
The largest parallelogram with horizontal sides has a size of 12.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 4
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 0 1
1 0 1 1 1 1 1 1 1 0
0 0 1 0 1 1 1 1 0 1
1 1 1 1 0 0 1 1 0 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 0 1 1 0 0 1
1 0 0 1 1 1 1 1 1 1
1 1 0 1 0 1 1 1 1 0
1 0 1 1 1 1 1 0 0 1
The largest parallelogram with horizontal sides has a size of 12.
4
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 1 4
Here is the grid that has been generated:
1 0 1 0 1 1 1 1 1 0
1 0 1 1 0 1 1 1 0 1
0 0 0 0 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 0
1 1 0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 0 1
0 1 1 1 1 0 1 0 1 1
1 1 1 0 1 1 1 1 1 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 1 0 1 1 0 1
The largest parallelogram with horizontal sides has a size of 16.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 5
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 1 1 1 0 1 1 1
1 1 1 0 0 1 1 1 0 1
1 1 1 1 1 1 1 1 1 0
1 0 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 1 0 0
1 1 1 0 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
1 0 0 1 1 0 0 1 1 1
The largest parallelogram with horizontal sides has a size of 15.
5
Test Cases Explained
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 1
Here is the grid that has been generated:
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
There is no parallelogram with horizontal sides.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 2
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 0
0 1 0 0 1 0 1 0 0 1
1 0 1 1 1 0 1 1 1 0
0 0 1 0 1 1 0 1 0 0
0 0 0 1 0 0 1 1 0 1
1 0 1 0 1 1 0 1 1 0
1 0 0 0 0 1 1 0 0 0
0 0 0 1 1 0 0 1 1 1
1 1 0 1 0 1 1 0 0 0
1 0 0 1 0 1 1 0 0 0
The largest parallelogram with horizontal sides has a size of 4.
6
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 3
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 0 1 0 1 0 0 1 1 1
1 1 0 1 0 1 0 1 1 1
1 0 1 1 1 1 1 0 1 1
1 1 1 0 1 0 0 1 1 1
1 1 0 1 1 1 0 1 1 1
0 0 1 0 0 0 1 1 0 0
1 1 1 0 1 1 1 1 0 1
1 1 0 1 1 1 1 1 0 1
1 1 1 0 1 0 0 0 0 1
The largest parallelogram with horizontal sides has a size of 12.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 4
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 0 1
1 0 1 1 1 1 1 1 1 0
0 0 1 0 1 1 1 1 0 1
1 1 1 1 0 0 1 1 0 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 0 1 1 0 0 1
1 0 0 1 1 1 1 1 1 1
1 1 0 1 0 1 1 1 1 0
1 0 1 1 1 1 1 0 0 1
The largest parallelogram with horizontal sides has a size of 12.
7
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 1 4
Here is the grid that has been generated:
1 0 1 0 1 1 1 1 1 0
1 0 1 1 0 1 1 1 0 1
0 0 0 0 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 0
1 1 0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 0 1
0 1 1 1 1 0 1 0 1 1
1 1 1 0 1 1 1 1 1 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 1 0 1 1 0 1
The largest parallelogram with horizontal sides has a size of 16.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 5
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 1 1 1 0 1 1 1
1 1 1 0 0 1 1 1 0 1
1 1 1 1 1 1 1 1 1 0
1 0 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 1 0 0
1 1 1 0 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
1 0 0 1 1 0 0 1 1 1
The largest parallelogram with horizontal sides has a size of 15.
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 布局算力新基建,九章云极DataCanvas公司赋能AI产业高质量发展
- EF重启尼泊尔支教之旅项目
- Telegram营销软件群发引流神器,解决你的引流烦恼
- 市场智者的选择 WhatsApp工具 专业海外营销专家揭示市场趋势的独到智慧
- 多伦科技董事长章安强受邀出席中国电动汽车百人会论坛并作主题演讲
- Ins拉群群发软件,Instagram引流助手,让你的营销无往不利!
- 世贸通美国EB5投资移民:揭秘美国爆红风景公路旁抢手项目
- 河北医科大学第四医院实施河北省首例单孔机器人同期胃肿瘤联合胆囊切除术
- 怎么样解决WhatsApp拉群的问题呢
- Telegram营销软件引流群发利器,教你自动引流吸粉
- 皓丽酒店智显屏全新上市!引领智慧酒店新形态
- Ins引流工具,Instagram营销软件,助你实现市场吸粉领先!
- 科技护航 智慧军休打通医养结合最后一公里
- 拉群群发专业工具:Line代筛料子助您摆脱冗余和错误
- 破局,社科赛斯考研颠覆中小企业生命周期规律
- 西部数据蝉联六年ETHISPHERE“全球最具商业道德企业”
- 业务大爆发 博主分享 WhatsApp拉群营销工具是我海外市场制胜的法宝
- Ins/Instagram营销软件,ins引流推广全新爆粉工具大揭秘!
- 普拉迪新机亮相深圳工业展,尽显高效加工魅力
- 飞芯电子多款产品闪耀AWE2024,助推家电与消费电子新发展
- ISLE 2024展会:洲明科技引领LED显示技术创新
- Alphawave Semi 宣布任命 Charlie Roach 为首席营收官
- 虚拟合作伙伴的奇境之路:2024年是否将揭示虚拟合作伙伴的奇境之路,为跨境电商 Telegram 群发云控开辟新路径
- 用户至上,体验为王:WhatsApp拉群工具的创新让每次互动都成为难忘旅程
- 春日有礼,西部数据和“她”一起开启存储焕新计划
- 同有科技全新一代自主可控全闪分布式存储震撼发布
- 超能商业时代的滑稽传说:迎来超能商业时代,准备好迎接一场科技跨境电商 Line 群发云控笑话盛宴吗
- zalo 拉群超能商务的未来预言:zalo筛选器是制定全球营销计划的得力助手
- 九章云极DataCanvas公司出席WBBA 2024宽带发展大会
- 道通智能新品行业应用无人机Autel Alpha发布,旗舰性能全面升级
推荐
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技