+1 (208) 254-6996 [email protected]

 programing language 

3 pages in 10 hours

Don't use plagiarized sources. Get Your Custom Essay on
Assignment # 7344La3
Just from $13/Page
Order Essay

ITI1120- Assignment 2 Due Saturday; April 10, 2021 @ 11:30 PM

Section A: Important Instructions

1. Read and follow the instructions below carefully.

2. This assignment is worth 7.5% of your grade.

3. Submit your assignment by 11:30 PM Saturday, April 10th, 2021 via Brightspace. Refer

to the course syllabus to understand the policy over late assignment submissions. You can

make multiple submissions, but only the last submission will be graded.

4. Before you can start this assignment, you need to know how to use google Colab or

Jupyter notebook to develop and test your code. Refer to lecture or lab material for help.

5. Assignments must be submitted in a notebook format (file extension .ipynb) using free

resources: either google Colab or Jupyter. The following information must be included at

the beginning of your assignment program:

# Course: IT1 1120

# Assignment number: 4

# Due Date: Sat April 10, 2021 11:30 PM

# Family name, Given name

# Student number

6. This is an individual assignment, NOT a group effort. Review and adhere to course

policies and the university Plagiarism and Academic Integrity policy presented during the

first lecture.

7. The assignment has 4 questions totalling 50 marks. Make sure you’ve written good

docstrings that include:

a. Type contract

b. Function description, including parameter names.

c. Preconditions (if any).

8. Make sure you use the provided master notebook file to document all answers to all


File name must be formatted a4_xxxxxx.ipynb (where xxxxxx is replaced with your

student number).

You must have minimum one code cell to answer each question. Your submission should

contain AT LEAST 4 cells.

Your program must run without syntax errors. In particular, when grading your

assignment, TAs will first open your file a4_xxxxxx.ipynb with either google Colab or

Jupyter notebook and press Run Module. If pressing Run Module causes any syntax error

for any cell, the grade for that question will be zero.

9. For each of the questions below, test example(s) are provided to test your solution. To

obtain a partial mark your solution may not necessarily give the correct answer on these

tests. But if your solution gives any kind of python error when run on the tests provided

below, that question will be marked with zero points.

10. To determine your grade, your solution will be tested both with examples provided in

each question and with extra examples.

Section B: Assignment Questions

Question 1: (10 marks)

Write a function called tally_scores that takes as a parameter the name of a file that contains a series

of student records and that prints a summary of each student record. A student record will begin with a

name followed by a sequence of integer test scores. The name is guaranteed to be one word and at the

beginning of the line. You may assume that each student has at least one test score. Your function should

produce two lines of output for each student: one showing the student’s name and test scores and a second

line showing the average score.

For example, if a file called records.txt contains the following:

John 71 83 94

Sally 94 85

Fred 90 95 82 85

and the following call is made:


the following output should be produced:

John: 71 83 94

average = 82.66666666666667

Sally: 94 85

average = 89.5

Fred: 90 95 82 85

average = 88.0

You are to exactly reproduce the format of this output. You may not construct any extra data structures to

solve this problem.

Question 2: (10 marks)

Write a function called underline that takes a file name as a parameter and that prints the words one per

line with certain words underlined. The words to be underlined all begin with a period. The period

should not be printed. You should print the text that follows the period on a line by itself followed by a

line of alternating dashes and commas equal in length to the text that follows the period.

Input stored in input.txt: Output from the call underline(input) Banana .avocado .peach PineApple-

pumpkin pie.


GRAPES pomegranateS












Notice that input lines can be blank lines. You may not construct any extra data structures to solve this

problem other than strings.

Question 3: (15 marks)

Write a function called merge_dict that takes two dictionaries, merge them, and returns a new

dictionary. The returned dictionary should contain all the keys of the passed dictionaries. Moreover, the

values of the common keys will be merged together in one list. However, the values of the unique keys

should stay in the same format they have appeared in the input dictionaries.

For example if you had the following dictionaries:

d1 = {1:”Moh”, 2:”Aseel”, 3:”Batoul”, 4:[“Taylor”, “Chan”, “Laura”]} d2 = {1: “Nahid”, 2:”Carter”, 3:”John”, 6:”Odak”}


{1: [‘Nahid’, ‘Moh’], 2: [‘Carter’, ‘Aseel’], 3: [‘John’, ‘Batoul’], 6:

‘Odak’, 4: [‘Taylor’, ‘Chan’, ‘Laura’]}

Another Example:

d1 = {1:”Moh”, 2:”Aseel”, 3:”Batoul”, 4:[“Taylor”, “Chan”, “Laura”]}

d2 = {1: “Nahid”, 2:”Carter”, 5:”John”, 4:”Odak”}


{1: [‘Nahid’, ‘Moh’], 2: [‘Carter’, ‘Aseel’], 5: ‘John’, 4: [‘Taylor’,

‘Chan’, ‘Laura’, ‘Odak’], 3: ‘Batoul’}

Question 4: (15 marks)

Consider a simple school management system that consists of two classes. A Student class and a Section


The Student class has the following attributes and behaviors:


name: string id: string score: float

__init_( ): initialize the student’s attributes.

getStdName( ): returns the name of the student

getStdId( ): returns the id of the student

getStdScore( ): returns the score of the student.

__str__( ): displays all the student’s information

The Section class has the following attributes and behaviors:


course_name: string

course_section: string

std_list: list

__init__( ): initializes the Section’s attributes.

add(): adds a new student. Pass the student object as a parameter.

remove(): removes a student from the list of the students. Pass the student object as a parameter

updateScore(): updates the score of a specific students. Pass the student object and the score.

displaySection(): displays all students’ information in the section.

averageScore(): calculates and displays the average score of the whole section.

Implement the two classes. Test your implementation by instantiating three objects of the Student class

and one object of the Section class. For example, if you write the code below in the main section of the

program and execute your code, you should get the below output:

s1= Student(“Mohamad”,”600053″,100)

s2= Student(“Hoda”,”700060″,200)

s3= Student(“Hassan”,”800090″,300)

sec= Section(“ITI1120″,”Section E”)












New student “Mohamad” was added successfully!

New student “Hoda” was added successfully!

New student “Hassan” was added successfully!

List of all students in section:

Mohamad 600053 100

Hoda 700060 200

Hassan 800090 300

Mohamad has updated his score!

List of all students in section:

Mohamad 600053 500

Hoda 700060 200

Hassan 800090 300

Average of entire section: 333.33

Removed Hassan from section list!

List of all students in section:

Mohamad 600053 500

Hoda 700060 200

Average of the entire section: 350.00

Good Luck 

Order your essay today and save 10% with the discount code ESSAYHELP