COMP1039: Problem Solving and Programming- IT Python Assignment

Download Solution Order New Solution
Internal Code: MAS1365

IT Python Assignment:

Introduction: This document is a kind of specification of the required end product that will be generated by implementing the assignment. Like many specifications, it is written in English and hence will contain some imperfectly specified parts. Please make sure you seek clarification if you are not clear on any aspect of this assignment. An important note about assignment 2... 1. This assignment is designed to provide you with further practise of the material we have already  covered (for example: lists, while loops, for loops, if statements, etc), just in a different (hopefully fun) context. 2. You are also introduced to a module that is used in the assignment (graphics) - you are not required to have extensive knowledge of or an understanding of this module; you are only required to be familiar enough with it in order to be able to use it to complete the assignment. You will not be examined on this module. 3. The practical work which covers this module is designed to help you understand how to use it and to provide you with further practise of the material previously covered - the prac work is also designed to help you with your assignment (so I recommend you do the prac work). Task: 1. Write a function called length() that takes a list as a parameter and returns the length of the list. You must use a loop in your solution. You must not use built-in functions, list methods or string methods in your solution. 2. Write a function called to_string() that takes a list as a parameter and returns the string representation of the list in the following form: List is: item1, item2, item3, item4 You must use a loop in your solution. You must not use built-in functions (other than the range() and str() functions), slice expressions, list methods or string methods in your solution. You may use the concatenation (+) operator to build the string. 3. Write a function called is_sorted() that takes a list as a parameter and returns True if the list is sorted in ascending order and False otherwise. You may assume that the elements of the list can be compared with the relational operators <, >, etc. You must use a loop in your solution. You must not use built-in functions, list methods or string methods in your solution. 4. Write a function called replace() that takes a list, an old value, and a new value as parameters. The function returns a copy of the list with all occurrences of the old value replaced by the new value. You must use a loop in your solution. You may make use of the list_name.append(value) method in order to build the new list. You must not use built-in functions, slice expressions, list methods (other than the append() method) or string methods in your solution. 5. Write a function called find() that takes a list and a value as parameters. The function searches for the value in the list and returns the index at which the first occurrence of value is found in the list. The function returns -1 if not found. You must use a loop in your solution. You must not use built-in functions, slice expressions, list methods or string methods in your solution. 6. Write a function called get_slice() that takes a list, a start value and a stop value as parameters. The function returns a copy of the list between start and stop-1 (inclusive). Check for the start and stop values exceeding the list bounds. If the stop value exceeds the list bounds, then make stop value the length of the list. If the start value exceeds the list bounds, then return an empty list. Check for the start value being less than the stop value. If the start value is greater than the stop value, return an empty list. You must use a loop in your solution. You may make use of the list_name.append(item) method in order to build the new list. You must not use built-in functions (other than the range() function), slice expressions, list methods or string methods in your solution. You must test your functions to ensure that they are working correctly. So you do not have to write your own test file, one has been provided for you. The assign2_partI_test_file.py file is a test file that contains code that calls the functions contained in the list_function.py module.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.