CT240 lab6
http://geminga.it.nuigalway.ie/~gettrick/courses/CT240/labs/l6.html
-
For this lab you must submit a printout of all source code (python
files), and the result(s) of running the program on (a few)
test cases.
The source code must
be well presented (indenting, spaces, reasonable variable/function names,
etc.) and must include comments (as a rough guideline - aim to have nearly as
many comments as lines of code). Any questions asked should be answered on a plain sheet of paper.
-
The above material should be given to Paul or left in the cardboard box marked CT240 in the mail room (room IT415) on the 4th floor of the IT Building
before
the deadline of 5pm
Monday 27th. October 2008. You will lose 20% for each day
(or part of day) the lab is late. If you have a genuine reason for
submitting a late lab, please contact Paul before the lab
due date/time.
-
Plagiarism (the unattributed copying of work from other sources
(internet, fellow students,....)) will not be tolerated. Please see
http://www.nuigalway.ie/engineering/documents/plagiarism_guide_students
_v4.pdf. You risk getting zero for your lab if it is found to be
plagiarized.
This weeks lab is based on the same (20x20) table of distances
between cities as used in lab 5 (see
here).
Do not use the PYTHON sort() method.
-
Write a program in python that asks the user to input a city (a number
from 1 to 20), and for that city calculates all other cities that are
a distance of between 100 and 300 km away (inclusive).
The result should be output
as a list of numbers (between 1 and 20). Your program should also check
that the string input by the user is indeed a number between 1 and
20, and if not print out a suitable error message and allow the user to
"try again". Use your program to find the answer to this problem if the
input is city 5, and submit this answer.
-
Write a program in python that asks the user to input a city (a number
between 1 and 20), and for that city calculates the city closest to it.
Your output should be a single number between 1 and 20. Again, check
the users input. (Obviously the output should not be equal to the input!)
©
NUI, Galway