A3 - comp

advertisement
The Hong Kong Polytechnic University
COMP1001 – Problem solving in IT
Due Date: 5:00pm, Friday, 2 October 2015
Assignment 3 – Text processing (40 marks)
1. [10 marks] Write a Python program that asks users for a string consisting of only the 26 English alphabets and returns the same string but
with the lowercase/uppercase inverted. For example, “AbCdEf” becomes “aBcDeF.” You may use the string methods, instead of writing
them from scratch.
2. [20 marks] Please write pseudocode for a program that receives from user his/her first name and last name, and the width and height of a text
box; and returns a printout of the name as below. Although you do not need to write a program, please write the pseudocode in a .py file
inside comments.
The Hong Kong Polytechnic University
3. [10 marks] A coin-removing game starts with two stacks of coins. One stack has M coins and the other N, where M and N are arbitrary
positive integers. Two players take turn to remove at least one coin from a stack. The one who removes the last coin will be declared as the
winner. Your task is to write pseudocode for a winning strategy which includes choosing to be the first or second player at the beginning.
Write the pseudocode inside comments in a .py file.
What to submit?
Python files with the name of COMP1001_A3_Qn_YourStudentID.py, where n is the question number of your programs
How to submit?
 Submit your assignment to blackboard. Other submission methods will not be accepted.
 For late assignments, your marks will be deducted as follows:
o 5 minutes or less (less 20%)
o 6 ~ 60 minutes (less 50%)
o More than 60 minutes (less 100%)
What are the consequences of plagiarism?
Generally if two submissions are similar in 80% or more of their content, they will be treated as plagiarism cases. All the students involved
not only will receive 0 marks for this assignment, they will also lose additional, same number of marks from their total assignment marks.
Moreover, we may report the serious cases to the Departmental Learning and Teaching Committee for further disciplinary actions.
~ End of Assignment 3 ~
Download