Home‎ > ‎ProgComp‎ > ‎

ProgComp 2018

ProgComp Website:

https://www.engineering.unsw.edu.au/computer-science-engineering/courses-programs/high-school-computing/progcomp

Includes details of the comp, prizes, and rules


Actual competition is held in another server 

Login with the Username and Passcode you were given by your teacher.

Your team has been allocated a Practice Assignment.  Tryout the questions.


HINTS and TIPS

I suggest you prepare some "toolkit" code/programs that will form the basis of each question in ProgComp.

Typically, each question will involve reading in some data (preferably, from a file) and processing each Record.

Usually, the first record is a number that represents the count of how many data records will follow.   There appears to be no explicit processing this number in the competition - i.e. we don't need to compare actual number of records processed with this count.  

But depending on the programming language you are using, this count may be useful to create a loop for each data record.

In Python, I feel this count is not really needed.  But we have to process the first record to separate it from the actual data records.

Suggestion 1.

  • Create a simple text file that is named the same as the Python file.
  • Copy the data for the program into it
    • Firstly, copy the test data
    • Then when happy code works, Copy the actual Programming Code

Suggestion 2.  Toolkit Code

The following code can be repeated for each question in the competition


# Data Input File Name
fn ='LPNin.txt'

#Process each data record as follows
def processRec(rec):

## Read Input from File
with open(fn,'r') as f:
    n = int(f.readline()) # get number of loops in first line

    # now read the rest
    for rec in f:
        ## process Record but first strip <CR><LF> at end of line
        nl = processRec(rec.strip())  




Subpages (1): Suggested Solutions
Comments