[SOLVED] python shell Skip navigation

$25

File Name: python_shell_Skip_navigation.zip
File Size: 263.76 KB

5/5 - (1 vote)

Skip navigation

PROGRAMMING FOR SCIENTISTS S2 2019
ANU College of Engineering & Computer Science

COMP1730/6730
Course content & schedule
Labs
Assessment
Archive

1.Home COMP1730/6730: Assessment Homework 1 (S2 2019)
Homework 1 (S2 2019)
Homework 1 (S2 2019)
This is the first homework assignment. Your goal in this assignment is to read and understand a simple program, and modify it so that it works. Along the way, it is also important that you get familiar with the python programming environment, and take your first step towards learning how to use it effectively.
Practical information
The assignment is due on Monday the 5th of August, at 11:55pm. To submit your solution, you will upload a single python file via wattle. Here is the assignment submission link.
In addition to submitting your solution, you must attend the following lab (in week 3). In the lab, your tutor will ask you some questions about your solution, and give you feedback if there is anything you need to improve. This discussion with the tutor is part of the assessment. If you fail to show up for the discussion with the tutor, you will receive zero marks for this assignment. If you do not submit a solution, you may still get partial marks for the discussion with the tutor.
The homework is individual. You must write your own solution, and you are expected to be able to explain every aspect of it.
If you have followed the lectures and worked through the exercises in lab 1, the assignment should not take more than one to two hours to complete.
The problem
This assignment problem uses the robot simulator that was also used in lab 1. First, you must download these two files:
robot.py
unstack.py
Save both files to the same directory.
The problem is how to unstack a tower of blocks. That is, to go from this:

to this:

The colours of the blocks are not important: After unstacking, the blocks should be ordered left-to-right in the same order that they were top-to-bottom in the tower, no matter what their colours are. The final position of the robot also does not matter.
unstack.py contains several functions that implement a solution to this problem. Because the robot (at least in simulation) can carry more than one block, the idea of the solution is that we will first unstack the top two blocks from the third, put down this stack of two, and then solve the smaller problem of unstacking the top block from the stack of two using the same manoeuvre. However, the implementation of this solution has some errors. Your task is to correct the errors.
unstack.py also contains two test functions, called test_unstack_two() and test_unstack_three(). The first tests the simpler case of unstacking just two blocks, while the second tests unstacking of a tower of three.
Because the file contains only function definitions, you will not see anything happen when you run it. To run the test functions, you must first run the file and then call the function, for example
In [1]: test_unstack_two()

(Remember that if you run the python interpreter from a terminal, you have to use the -i flag to leave the shell in interactive mode after running the file.)
The first error you will encounter is a NameError. As mentioned in the lecture, this means there is a mismatch between the name of a functions definition and use. Use the information from the python error message to track down where the error is.
Once you have resolved this error, the test_unstack_two() function should work. In the solution for unstacking three blocks there is a logical error that may require more thought to fix. However, it does not require a big change to the functions. You should not write an entirely new program. Focus on understanding how the given program is intended to work, and what changes are needed to make it work. (It may be as simple as changing one line.)
Marking
What to submit
You should edit the file unstack.py that you downloaded, then upload only this file with your corrections using the assignment submission link on wattle. Do not edit (and do not try to upload) robot.py.
The file that you submit must meet the following requirements:
It must be syntatically correct python code.
Like the file you downloaded, your solution should be implemented in functions; anything outside of function definitions in the file will be ignored. The file must of course include the import statement, and you can (and should!) use comments.
The two functions test_unstack_two() and test_unstack_three() must not be modified (that is, they should be exactly the same as in the file you downloaded). We will test if you have solved the problem using the same testing procedure that is described by these two functions.
As mentioned above, you must also attend the following lab (in week 3) and answer your tutors questions about your solution. This discussion is part of the assessment. You should be prepared to answer or demonstrate to the following questions:
Can you download the file that you submitted from wattle?
Can you run that file in the python interpreter (using an IDE of your choice) on the CSIT lab computer?
If the file has syntax errors, can you use the error messages from the interpreter or IDE to identify where the syntax errors are?
Does your submitted file meet the requirements stated above? Does it contain anything that is not a function definition, an import statement, or a comment? If so, can you point it out?
What was the cause of the NameError in the original file, and how did you fix it?
How did you fix the logical error in the unstack_tower_of_three function? Was this the smallest change necessary to fix the error? Could it have been done with a smaller change?
The original file had comments describing the each function, and the assumptions about the state of the robot when the function is called. Are these comments still accurate in your version? Have you modified the comments so that they correctly describe the functions that you modifed?
In marking this assignment we will consider the following:
Does your submitted file satisfy the requirements specified above?
Do the two test cases (test_unstack_two and test_unstack_three) work with your modified solution?
Your ability to use the tools (e.g., the IDE or python interpreter), your understanding of pythons error messages, and your understanding of the solution, as demonstrated in your discussion with the tutor.
The assignment is worth 2% of your final mark.
Updated:28 Jul 2019
Responsible Officer:Head of School
Page Contact:Patrik Haslum
Contact ANU
Copyright
Disclaimer
Privacy
Freedom of Information
+61 2 6125 5111The Australian National University, CanberraCRICOS Provider : 00120CABN : 52 234 063 906

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] python shell Skip navigation
$25