It's UWAweek 47

help2200

This forum is provided to promote discussion amongst students enrolled in CITS2200 Data Structures and Algorithms.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 3 articles in this topic
Showing 3 of 176 articles.
Currently 17 other people reading this forum.


 UWA week 13 (1st semester, week 5) ↓
SVG not supported

Login to reply

👍x5
helpful
12:05pm Wed 27th Mar, ANONYMOUS

Hi, I have found an error in the testing code that may cause the code to crash on different seeds/starting parameters. In test_get_rank_time(), on line 103, the variable "size" is defined to be a random integer between 0 and SIZE inclusive. Later, on line 106, the function random.randint(1, len(runs)), where len(runs) = size (which can be zero). If size = 0, then on line 106, the function random.randint(1,0) is called, which will throw an error, regardless of what is in our code. Can we either (a) be assured that initial conditions will be chosen such that this error will not occur, and if it does occur, we will not be penalised, or (b) get the error fixed (for instance, by changing line 103 to size = random.randint(1, SIZE) )? Thanks very much!


SVG not supported

Login to reply

👍x1
helpful
5:23pm Wed 27th Mar, ANONYMOUS

my code is passing all tests until i change the size variable to under ~ 90 in the testing program do you think that this could be why? because before when i tested i was having failures but no errors until size was lower then 10.now I'm unsure if it is due to the code or what has been explained above.


SVG not supported

Login to reply

👍?
helpful
7:06pm Thu 28th Mar, Nico B.

I was having a similar issue, with errors from test_submit_run() when either RUNS > 83, because then size <= 1. It was an AttributeError: 'NoneType'. I had to correct the sorting algorithm to make sure that if len(runs) <= 1, it would return runs (as it is already sorted). My error was specifically because I had just written `return` and not `return runs`, so it was NoneType. When it is running more tests, it is more likely to encounter a situation that the code no longer works. This is why it was only working for RUNS <= 83, because after that, size would be 1, so the error would occur. I was able to identify this by adding `try... except...` and printing size when the error occurred. I am now passing all tests with the new version (27 March 2024 4:05PM) of test_speedrunning.py

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy