Python代写 | HS1031 Assessment Task – Final Assessment

本次Python代写是完成基础的编程问题
Assessment Task – Final Assessment
Unit Code: HS1031

1. Explain what a computer program written in Python does and translate a given algorithm into
Python code.
2. Identify and fix the various types of coding errors i.e. syntax, logical, and run-time.
3. Apply standard algorithms and libraries and import built-in modules to solve a given problem.
4. Understand and explain the basic programming constructs.
5. Understand the ICT profession and professional expectations of computer programming.
Description: Each week students were provided with three tutorial questions of varying degrees of
difficulty. These tutorial questions are available in the Tutorial Folder for each week on Blackboard.
The Interactive Tutorials are designed to assist students with the process, skills and knowledge to
answer the provided tutorial questions. Your task is to answer a selection of tutorial questions for
weeks 1 to 5 inclusive and submit these answers in a single document.
Instructions:
• Please use the Final Assessment Answer Sheet for your answers.
• Save your answers in MS Word document file format and submit via Blackboard
• If your answer involves Python code, make sure to introduce appropriate indentation where
relevant.
• Please note that all submissions will be subject to plagiarism checking. Please refrain from
copying answers from your colleagues, the Internet or getting someone else to do the
assignment on your behalf. Plagiarism cases will be dealt with in accordance with Holmes
Academic Conduct and Integrity Policy.
• If you have any questions regarding this assessment, you are encouraged to either submit
your questions in Discussion Board or discuss them directly with your lecturer in Drop-in
sessions.
Assume that the variable dict refers to the dictionary {‘Mark’:30, ‘Martin’:20, ‘Michael’: 80}. Write
the expressions that perform the following tasks:
a. Add a new student “Alex” to dict with a score of 15
b. Now increase the score for Alex, such that his new score is equal to the sum of Mark and
Martin’s scores
c. Remove Martin from dict
d. Find the length of dict after Alex has been added and Martin removed
Week 11: Question 03 – 6 marks
Define a recursive function fun(word, index=0). The function takes two arguments, a word and index
(index takes values from 0 up to the length of word). The function prints out a ‘reversed version’ of
the word passed to it as an argument. You can assume that index is always initiated to 0.
For example:
For fun(‘Book’,0) or fun(‘Book’)
The output should be:
‘kooB’
Write a code segment that opens a text file for input and prints out the number of words with a
length of 4 or more (e.g. home has a length of 4 while flower has a length of 6). Your code must do
the following:
a. Strip punctuation marks out of words. For the purpose of this exercise, punctuation marks
are: (‘ .!?,-“).
b. Print each word with a length of 4 or more in a separate line, along with its length. Make
sure to format your output in a tabular format (two columns format).
c. Finally, print a message which shows the total number of words with a total length of 4 or
more.
For example, assume that your text file (.txt) includes the following text:
Hello World! I am a student at Holmes Institute.
I enrolled in Introduction to Programming to learn Python.
So far so good. Programming is fun!
Your output should look like the following:
Week 09: Question 03 – 8 marks
Write a function listMerge which takes two lists of random numbers (or two lists of random letters)
as arguments. Your function merges the two lists and sorts the new resulting list in descending order.
Finally, the new list is printed on the screen. For example:
• If lyst1=[2,1,3] & lyst2=[6,4,5]
The output for listMerege(lyst1, lyst2) would be:
[6,5,4,3,2,1]
• If lyst1=[‘b’,’a’,’c’] & lyst2=[‘f’,’d’,’e’]
The output for listMerege(lyst1, lyst2) would be:
[‘f’, ‘e’, ‘d’, ‘c’, ‘b’, ‘a’]