BIS1003-Introduction to Programming Intensive

profileAbdulmalek
BIS1003_Workshop_Topic9.pdf

BIS1003 Introduction to Programming

Workshop 9

Topic 9: Strings and dictionaries

Apply and test your knowledge of the current and previous topics by attempting the

questions below. Completing these questions will help you to succeed in your subject.

Workshop Questions

1. Write a program that asks the user to input the number of students of a class named

BIS1003. The program then will ask the user to input: the ID, Assignment 1 marks,

Assignment 2 marks and Final Exam marks for every student. The program needs to

validate the marks out of 100. Use a dictionary to store the ID and marks of the

students. After the user finishes entering the students' info, the program should

display the student ID and their marks. The program should be able to handle

exceptions.

2. Modify your code for question 1 to calculate the Final Marks by adding the weighted

marks of the assignments and the Final Exam. Weight of Assignment 1, Assignment

2 and Final Exam can be 25%, 25% and 50%, respectively. The program should

display the final result as follows:

Student ID Assignment 1 Assignment 2 Final Exam Final Result (Weighted)

1 70 80 85 80

2 80 90 90 88

. . . . .

. . . . .

The program should be able to handle exceptions.

3. Modify the program for question 2 to remove a student from the BIS1003 class. The

program should ask the user to enter the Student ID who wants to be removed from

the class. The program should display the student's information and then display the

remaining students list from the dictionary after removing the students. The program

should be able to handle exceptions.