ProgComp Website:https://www.engineering.unsw.edu.au/computer-science-engineering/courses-programs/high-school-computing/progcompIncludes 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 TIPSI 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.
Suggestion 2. Toolkit CodeThe following code can be repeated for each question in the competition # Data Input File Namefn ='LPNin.txt'#Process each data record as followsdef processRec(rec):## Read Input from Filewith 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()) |
