首页 > 其他分享 >COMP9021 Principles of Programming

COMP9021 Principles of Programming

时间:2024-06-13 15:00:47浏览次数:24  
标签:bars Programming Principles Here values between represented difference COMP9021

COMP9021 Principles of Programming
Term 2, 2024 Coding Quiz 1Worth 4 marks and due Week 3 Thursday @ 9pmDescriptionYou are provided with a stub in which you need to insert your code where indicated without doing anychanges to the existing code to complete the task. You may import any module that is already installed inEd if you wish.The current code generates a random list of integers between 1 and 6 whose length is chosen by the user
and displays the list.Your task is to output the absolute difference between the first and the last values, displays the values as
orizontal bars of dollars ($), and displays the values as vertical bars of stars (*).


Marking
Absolute Difference 1.0 mark
Horizontal Bars 1.5 marks
Vertical Bars 1.5 marks
--------------------------------------------
Total 4.0 marks


Due Date and Submission
Quiz 1 is due Week 3 Thursday 13 June 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, anyate submission after Week 3 Sunday 16 June 2024 @ 9pm will be discardedMake sure not to change the filename quiz_1.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 Edotherwise your mark will be zero for Quiz 1.

Test Cases

$ python quiz_1.py

Enter two integers, the second one being strictly positive: 3 1
Here are the generated values: [2]

The absolute difference between first and last values is:
0

Here are the values represented as horizontal bars:

$ $

Here are the values represented as vertical bars:

*
*

 


$ python quiz_1.py

Enter two integers, the second one being strictly positive: 0 2
Here are the generated values: [4, 4]

The absolute difference between first and last values is:
0

Here are the values represented as horizontal bars:

$ $ $ $
$ $ $ $

Here are the values represented as vertical bars:

* *
* *
* *
* *

$ python quiz_1.py

Enter two integers, the second one being strictly positive: 0 4
Here are the generated values: [4, 4, 1, 3]

The absolute difference between first and last values is:
1

Here are the values represented as horizontal bars:

$ $ $ $
$ $ $ $
$
$ $ $

Here are the values represented as vertical bars:

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

$ python quiz_1.py

Enter two integers, the second one being strictly positive: 1 8
Here are the generated values: [2, 5, 1, 3, 1, 4, 4, 4]

The absolute difference between first and last values is:
2

Here are the values represented as horizontal bars:

$ $
$ $ $ $ $
$
$ $ $
$
$ $ $ $
$ $ $ $
$ $ $ $

Here are the values represented as vertical bars:

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

$ python quiz_1.py

Enter two integers, the second one being strictly positive: 2 13
Here are the generated values: [1, 1, 1, 3, 2, 6, 6, 3, 3, 5, 2, 5, 1]

The absolute difference between first and last values is:
0

Here are the values represented as horizontal bars:

$
$
$
$ $ $
$ $
$ $ $ $ $ $
$ $ $ $ $ $
$ $ $
$ $ $
$ $ $ $ $
$ $
$ $ $ $ $
$

Here are the values represented as vertical bars:

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

标签:bars,Programming,Principles,Here,values,between,represented,difference,COMP9021
From: https://www.cnblogs.com/qq99515681/p/18245200

相关文章

  • SuntoryProgrammingContest2024(AtCoder Beginner Contest 357)
    A-SanitizeHands题意:给定一个序列和m,问m按顺序减去这个序列,m>=0情况下最多能减多少个数思路:前缀和+prev(upper_bound())总结:disinfectan(消毒ji),disinfect(消毒,杀毒),aliens(外星人),voidsolve(){ intn,m; cin>>n>>m; vector<int>a(n); for(inti=......
  • 操作系统入门系列-MIT6.828(操作系统工程)学习笔记(四)---- C语言与计算机架构(Programmin
    系列文章目录操作系统入门系列-MIT6.S081(操作系统)学习笔记(一)----操作系统介绍与接口示例操作系统入门系列-MIT6.828(操作系统工程)学习笔记(二)----课程实验环境搭建(wsl2+ubuntu+quem+xv6)操作系统入门系列-MIT6.828(操作系统工程)学习笔记(三)----xv6初探与实验一(Lab:Xv6and......
  • 2024 江苏省大学生程序设计大赛 2024 Jiangsu Collegiate Programming Contest(FGKI)
    题目来源:https://codeforces.com/gym/105161文章目录F-DownloadSpeedMonitor题意思路编程G-DownloadTimeMonitor题意思路编程K-NumberDeletionGame题意思路编程I-IntegerReaction题意思路编程写在前面:今天打的训练赛打的很水·····,我发现我们......
  • EBU4201 Introductory Java Programming 2023/24Mini Project(⼉童练习乘法表 下个文
    Task1[25marks]SuperHeroTTisasimpleGraphicalUserInterface(GUI)applicationforchildrenwheretheycanpractisetheirtimestables(seeFigure1).Whenlaunched,yourappshouldlooklikeFigure1-FirstlaunchofSuperHeroTT.Thedrop-downbo......
  • HITSC_Testing and Test-First Programming
    目标测试优先模块设计:等价划分、边界值分析覆盖度本节内容如下Softwaretesting测试是为了“破坏”好的测试?能发现错误不冗余有最佳特性别太复杂也别太简单测试等级回归测试包含三类单元、集成、系统,对应不同的级别一些概念静态和动态测试:静态只能发现一些......
  • Tokio Marine & Nichido Fire Insurance Programming Contest 2024(AtCoder Beginner C
    A-WhoAtetheCake?题意:有三个嫌疑犯(1,2,3(号码))现在有两个证人他们指出谁不是嫌疑犯,你可以找到确定的那个罪人吗?找到输出这个人的号码没找到输出-1思路:如果两人指出的人是一个人则输出-1不是则输出6-a-b,因为1+2+3=6(sum)减去a,b肯定可以到达......
  • The 2024 International Collegiate Programming Contest in Hubei Province, China
    Preface感觉好久没训练了,这周末又要出战西安,只好找个平时的晚上抽空训练一场这场题本身质量还是不错的,但由于徐神被模拟题关了一整场,我前期被一个分类讨论写的心态爆炸导致最后一个medium的计数题没做出来,然后一个medium~hard的D题转化和性质基本都挖掘完了,最后没想到暴力增量......
  • 2024 ICPC National Invitational Collegiate Programming Contest, Wuhan Site
    2024ICPCNationalInvitationalCollegiateProgrammingContest,WuhanSiteI.CyclicAppleStrings题意:给定一个01字符串,每次操作可以将这个字符串向左循环移动任意次数,求让这个字符串变成有序的需要最少几次操作思路:每次只能减少最右边的不和有边界相邻的一个1的长块,每次......
  • 2024 Jiangsu Collegiate Programming Contest
    Preface这场由于是学长们出的题,在5.5就作为验题队伍VP了一遍本来验题场一般是三人三机火速开题的,但由于那天徐神没带电脑,索性就三人一机当作训练来打最后经典被队友带飞,4h8题后和NJU的WF银牌队只差一题,然后最后1h我冲刺H题失败,耻辱下机吃花雕A.Two'sCompanybutThree'sTr......
  • 探究:响应式编程(Reactive Programming)
    在当今软件开发领域,响应式编程(ReactiveProgramming)成为了一个备受关注的话题。它提供了一种新的编程范式,与传统的命令式编程有着显著的不同。本文将详细讲解什么是响应式编程,以及它与传统的命令式编程的不同之处。1.什么是响应式编程?响应式编程是一种编程范式,它基于数据流和变......