Comp930 Fall 2024 assignment #1.pdf
Comp930 Fall 2024 assignment #1.pdf
Assignment#1
Weightage 10% Due Date :::
Programming 2
INSTRUCTOR: Parwinder Kaur
CLASS: Comp 930
Instructions
Read all questions carefully.
Partial marks are not awarded.
Avoid Using Chat GPT.
No cell phones permitted.
No sharing of information between students.
DATE:
STUDENT NAME:
STUDENT NUMBER:
Fun fact: In the movie 2001: A Space Odyssey, the ship computer is called HAL,
which is IBM rotated by -1.
Write a function called ceaser_cypher that takes a string and an integer as parameters,
and returns
a new string that contains the letters from the original string rotated by the given
amount.
Hint: You might want to use the built-in function which converts a character to a
numeric code, and converts numeric codes to characters.
Constrains: You will need to differentiate between upper and lowercase characters. For
example, If A is rotated by, it will become C(upper-case), but if a is rotated by 2, it will
become c (lower-case).
Write a function called estimate_pi that uses this formula to compute and return an
estimate of π. It should use a while loop to compute terms of the summation until the
last term is smaller than
1e-15, which is Python notation for 10−15 .
Hint: To implement factorial, you can use
https://docs.python.org/3/library/math.html#math.factorial
4. Read the following flow chart and write down the script? 5 marks
Hints
character = '#' # The symbol to print
numRows = 7 # The number of rows
space = ' ' # The space character
Pattern:
Q6
Create a script for the following flowchart? 5 Marks
Submit Python Code and screenshot of Python code and execution in a PDF or Word
File (StudentNumber_Groupnumber_assignment.PDF),please make sure you put at
least three screenshots (one for each part)
Note: Replace StudentNumber with your student ID. For example, if your student id is
C071234567 your compressed file should be called C071234567.zip or C071234567.rar
Deadline: Please refer to the deadline indicated on the assignment page
Task 1 The Program woks Some parts The Program
successfully of program does not work
Full Marks work (For NO Marks
example
Question
number 4
have 3
parts . First
works but
second and
third does
not work
then
student
will get
marks for
first part it
Alpha college of Business and
Technology
ould be
2+2+1)
Task 2 The Program woks Some parts The Program
successfully of program does not work
Full Marks work NO Marks
Task 3 The Program woks Some parts The Program
successfully of program does not work
Full Marks work NO Marks
Task 4 The Program woks Some parts The Program
successfully of program does not work
Full Marks work NO Marks
Task 5 The Program woks Some parts The Program
successfully of program does not work
Full Marks work NO Marks
Task 6 The Program woks Some parts The Program
successfully of program does not work
Full Marks work NO Marks