HerefordshireCollege of Technology

Validated by the University of Gloucestershire

FdSc in Information and Communication Technology

Student:
Assessor: Leonard Shand
Module: 106 - Introduction to Programming
Title: Python – Assignment 2 (50% of total module)
Internal Verification of assignment: Bob Higgie
Date: 26 September 2018
Issue Date: 20 November 2013
Outcome and Principal Objective(s):
1.Appreciate the stages of the software development lifecycle
2.Comprehend the structure of a procedural programming language and the syntax of a specific language such as Java
3.Design small units of software according to a specification
4.Produce working software from a design
6.Apply appropriate quality processes to programming activities
7.Apply skills relevant for academic progression and career development within the sector
8.Advance their academic prospects and career prospects by identifying research opportunities and sector trends
9.Demonstrate an understanding of a range of planning and information search technologies
10.Demonstrate an understanding of the Harvard referencing system
Overall percentage score (provisional until after the examination board meeting):
Sections / 1,2, 3,4, 6 & 7 / 8 / 9 / 10
Score
Maximum / 50 / 35 / 10 / 5
Assessor's Overall Comments:
Due Date / Submitted date / Pass/Fail/Refer / Assessor / Verifier
1 10Jan 2014
2
3
Date assessment completed:

Allocation of Marks for Module 106

Assignment 1 – Pythonand report...... 50% (2000 words equivalent)

Assignment 2 – Python Program ...... 50% (2000 words equivalent)

Project brief:

This coursework component is worth 50% of the overall coursework mark for this module. The coursework is for 100 marks.

The design should represent the following scenario.

Scenario 1

Computing Prime Numbers

A common type of computation is the generate-and-test method, in which one systematically generates potential solutions to a problem, and then applies a sequence of one or more tests to determine if the proposed solution is in fact valid. While one could in principle (and under some circumstances one must) generate potential solutions randomly or according to some probability distribution, often it is more efficient to devise a systematic method for generating all candidate solutions.

Write a program that computes and prints up to the 1000thprime number.

Hints:

To help you get started, here is a rough outline of the stages you should probably follow in writing your code:

1. Initialize some state variables

2. Generate all (odd) integers > 1 as candidates to be prime

3. For each candidate integer, test whether it is prime

1. One easy way to do this is to test whether any other integer > 1 evenly divides the candidatewith 0 (zero) remainder. To do this, you can use modular arithmetic, for example, the expression a%b returns the remainder after dividing the integer a by the integer b.

2. You might think about which integers you need to check as divisors – certainly you don’t need to go beyond the candidate you are checking, but how much sooner can you stop checking?

4. If the candidate is prime, print out some information so you know where you are in the computation, and update the state variables

5. Stop when you reach some appropriate end condition. In formulating this condition, don’t forget that your program did not generate the first prime (2).

Use these ideas to guide the creation of your code.

If you want to check that your code is correctly finding primes, you can find a list of primes at

1. Quality processes and relevant skills (50% - Outcomes1, 2, 3, 4, 6 and 7)

Write the program. Ensure that it is appropriately commented and complies with the IT sector norms. Document the quality processes that would be required for programming activities in an IT programming environment. Also document any testing of individual blocks of code such as specific functions, loops, decisions, etc. Ensure that the user of the program is provided with sufficient feedback throughout the program as it is running.

2. Research opportunities and sector trends (35% - Outcome 8)

a) In the programming task you are asked to work with prime numbers and mod values. Do research as to which sectors of the IT industry this would most likely be used. Briefly discuss your findings.

b) Write a function that takes an integer as input and returns a list of prime factors. This process is known as prime factorisation and should output a list such that if multiplied together, they will result in the original number. Note that there could be repeats in a list: e.g. if 12 is input the output would be [2, 2, 3].

3. Planning and search techniques (15% - Outcomes 9 and 10)

Produce a project timeline for this coursework using MS Project, Gantt project or similar software. Produce this in your report. In your report document all your searches and cite all references. Create a reference list using the Harvard method.

You are to provide a listing of your code as well as a screenshot of your output.