Individual Assignment Specifications
Purpose:
This assignment evaluates your understanding of basic programming principles using Python language. In particular, it assesses your ability to develop algorithms to solve simple problems, successfully run Python programs, and your ability to write meaningful comments when required.
HS1031 Introduction of Programming – Individual Assignment
Page 3 of 5
Marking criteria
Question
Marking criteria
Marks
Question 1
Appropriate commenting
2
Sound logic
2
Code running successfully
2
Total
6
Question 2
Appropriate commenting
2
Sound logic
2
Code running successfully
2
Total
6
Question 3
Appropriate commenting
2
Sound logic
3
Code running successfully
3
Total
8
Total Marks
20
HS1031 Introduction of Programming – Individual Assignment
Page 4 of 5
Write a program (name it pension.py) that asks the user for their name and age. The program then tells the user the year they are eligible for pension, which is 67 in Australia. The program should print out the user’s name as well as their pension’s year in one sentence.
For example:
If Jenny whose age is 20 executed the program in the year 2020, the program prints out the following message: “Hey Jenny, you will be eligible for pension in 2067”
If Mark whose age is 45 executed the program in the year 2008, the program prints out the following message: “Hey Mark, you will be eligible for pension in 2030”.
Marks Distribution
Criteria
Comments
Logic
Execution
Total
Mark
2
2
2
6
Write a program and save it as wordCheck.py. In your program, define a function symmetric () which takes a word as an argument and returns True if the word is asymmetric and returns False otherwise. A symmetric word is a word that reads from left to right and right to left.
For example:
symmetric(‘Mom’) returns True
symmetric (‘Civic’) returns True
symmetric (‘World’) returns False
symmetric (‘English’) returns False
Hint:
Start by prompting the user for a word
Convert the word into small letters
Write the rest of the program
Marks Distribution
Criteria
Comments
Logic
Execution
Total
Mark
2
2
2
6
Write a program and save it as py. In your program, define a function passGen, which takes two arguments:strength and passLength. The value of strength can either be strong or medium (default is strong) and the value of passLength ranges from 8-12 (default is 8).
If password’s length is less than 8 or greater than 12, the program prints out the following message: “sorry, password must consist of at least 8-12 characters”.
If password’s strength is set to ‘medium’, an 8-12 long random password is generated out of the following characters: “abcdefghijklmnopqrstuvwxyz”
HS1031 Introduction of Programming – Individual Assignment
Page 5 of 5
If password’s strength is set to ‘strong’, an 8-12 long random password is generated
out of the following characters:
“abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXY
Z!@#$%^&*()?”
For example:
If the input is: passGen(‘strong’, 10)
A possible valid output would be: ^CYpJ?V8d*
If the input is: passGen(‘medium’, 8)
A possible valid output would be: deovfimc
If the input is: passGen()
A possible valid output would be: vyxT0M8z
(remember, the default for strength is ‘strong’ and the default for length is 8)
Marks Distribution
Criteria
Comments
Logic
Execution
Total
Mark
2
3
3
8