Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help using python code. Exercise 6 It is time to add input validation to make the code more robust: - The current earned credit

please help using python code.
image text in transcribed
image text in transcribed
Exercise 6 It is time to add input validation to make the code more robust: - The current earned credit points should be a float >0 - The current earned credits should be an integer >0 - Number of courses this semester should be an integer >=0 - Course codes should consist of four letters followed by four digits - Number of credits for each course should be an integer >=0 - Grades should be foat between 0 and 100. Add all these input validation and test your code. Enter your current earned credit podnts: two hundred Earned credit points should be a positive nusber. Enter your current earned credit points: 36.5 Enter your current earned credits: twenty Earned credits should be a positive integer. Enter your current earned credits: 10.5 Earned credits should be a positive integer. Enter your current earned credits: 12 Enter the number of courses that you are taking this seoster: 2.5 Number of courses should be a positive integer. Enter the number of courses that you are taking this semester: 4 Enter the course code for course a1: corvieze Enter the number of credits of cospie2e: 3 Enter the grade obtained in coskeze: 92 Enter the course code for course =2: INFS Course code should include four letters followed by four digits. Enter the course code for course =2:1.201 Course code should include four letters followed by four digits. Enter the course code for course m2: INFS12e1 Enter the number of credits of INFS1281: 40.5 Credit of a course should be a positlve integer. Enter the number of credits of INFS1291: 4 Enter the grade obtained in INF51201: 78 Enter the course code for course *3: INFT12e1 Enter the number of credits of INFT1281: 4 Enter the grade obtained in INFT12e1: 196 grade should be less than or equal to 1 ee! Enter the grade obtained in INFI12e1: 96 Enter the course code for course m4: MATHIe3 Course code should include four letters followed by four digits. Enter the course code for course m4: MATHIe3e Enter the number of credits of MATH1e3e: 3 Enter the grade obtained in MATHLe3e: 86 Your semester GPA is: 3.4642857142857144 Your cumulative GPA is: 3.26923e76923e769 Exercise ? As entering all the courses, credits and grades takes time, we will now use a different structure. We assume that we have three lists that contain, the courses names, the credits of each course and the grades in each course. For example, using the same example as we are using so far we would have at the beginning of our code the following three lists: courses= ["Past", "CONM1e2e", "INFS1201", "INFT12e1", "MATH1e3e"] credits [12,3,4,4,3] grades =[36.5,92,78,96,86] Note that "Past" refers to the credit points and credits earned so far until the previous semester. Based on this structure compute the semester GPA as well as the cumulative GPA. With the same input as above, your code should simply return: Your semester GPA is: 3.4642857142857144 Your cumulative GPA is: 3.269230769230769 Exercise 8 Same exercise as before but with a unique list that contains all the required data: course code. followed by credit, followed by grade. data-["Past", 12, 36.5, "CoMn1e2e", 3, 92, "INFS12e1", 4, 78, "INFT12a1", 4, 96, "MATH1e3e", 3, 86] The sample run should return exactly the same. Your semester GPA is: 3.4642857142857144 Your cumulative GPA is: 3.269236769230769

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions