Question: Hello there, I need help, I know my (python in visual studio) code is huge, but I just need help fixing specific things on it.

Hello there, I need help, I know my (python in visual studio) code is huge, but I just need help fixing specific things on it.

From the instructor:

- The design of your Individual, Student, and Instructor classes is good. You needed to make some changes to your displayInformation methods, though - they don't quite work correctly. You named the ID properties incorrectly, for instance.

Your Validator class looks pretty good, though you have a couple of things that needed another look. For example, your Instructor ID and Student ID checks could be combined. All you need to do is introduce a parameter called max_length and write your if statement like this:

if len(student_ID)

Then, you would pass in the value of max_length (5 or 7 depending on the user type) to the method as an argument.

- Your validation code also looks pretty good, but you never called any of the methods you wrote. All of your checks simply ensure that a value was provided (except for the program check, which doesn't work because line 132 is indented over to the right too far.

- You have some redundant code in your main program loop. You should get username and email information, and then branch off to gather the other user-specific information. Lines 202-107 and lines 217-222 are also redundant with one another.

-Lines 224-225 needed to be indented more to the left (placed out of the main while loop, in other words). This didn't need to run on every iteration of the loop. There is also a typo in this code and inconsistency in how you named that method you're calling that is causing your program to crash.

Hello there, I need help, I know my (python in visual studio)code is huge, but I just need help fixing specific things onit. From the instructor: - The design of your Individual, Student, andInstructor classes is good. You needed to make some changes to yourdisplayInformation methods, though - they don't quite work correctly. You named the

18 ERFI 5 6 + N 000 class Individual: "Creating a paranten class called College def __init__(self, name, ID, email): self.name = name self.ID = ID self.email = email 7 9 10 11 12 13 class Instructor(Individual): def __init__(self, name, instructor_ID, email, last_institution, high_degree): ""Child class describing Instructor" super() . _init_(instructor_ID, name, email) self.last_institution last_institution self.high_degree high_degree 14 15 = 16 17 18 19 20 def display Informatio(self): print(" ID: + self.instructor_ID) print(" Name: " + self.name) print("Email:" + self.email) print("Last institution: " + self.last_institution) print("High Degree: " + self.high_degree) 21 22 23 24 25 class Student(Individual): 26 27 28 def __init__(self, student_ID, name, email, program): """Child class Student inherits from class College super() . _init_(student_ID, name, email) self.program = program 29 30 31 32 33 34 def displayinformatio(self): print(" ID: + self.student_ID) print(" Name: + self.name) print("Email: + self.email) print("Student program: " + self.progeam) 35 36 37 38 39 40 41 42 43 44 45 class Validator: "**"Creating a class to validate the users' inputs.' def InstructorID(self, instructor_ID): if len(instructor_ID) ", "/", "?", ";", ":", "[", "]", "[", "}", "\\"] 78 79 80 81 82 83 84 85 return student_email #Validating user email def isEmailok (self, passed_user_email): bad_chars = ["!", "#", "$", "%", "A", "&", "*", "(", ")", "_", if passed_user_email: for character in passed_user_email: if character in bad_chars or character.isdigit(): print("User email is incorrect. Please try again.") return false return True else: print("User email is missing. Please try again.") return False #Getting users' information #Getting student informations. def getstudentID(self): """getting student ID""" id_OK = False while not id_OK: student_id = input("Enter student_ID: ") if student_id: id_OK = True 86 87 88 89 90 91 92 93 94 95 96 96 id_OK = True return student_id def getstudentname(self): """Getting student Name.""" name_OK = False while not name_OK: student_name = input("Enter student name: ") if student_name: name_OK = True 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 return student_name ">", "/", "?", ";", ":", "[", "]", "{", "}", "\\", "."] def isNameOK(self, passed_student_name): """Checking for bad_char in student name". bad_chars = ["!", "", "@", "#", "$", "%", "-", "&", "*", "(", ")", if passed_student_name: for character in passed_student_name: if character in bad_chars or character.isdigit(): print("Student name is incorrect. Please try again.") return false return True else: print("Student name is missing. Please try again.") return false 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 def getProgram (self): """Getting student program." program_OK = False while not program_OK: student program = input("Enter program name: ") if student_program: program_OK = True return student_program #getting Instructor information. def getinstructorID(self): "getting instructor ID""" id OK = False while not id_OK: instructor_id = input("Enter Instructor_ID: ") if instructor_id: id_OK = True return instructor_id return instructor_id def getinstructorname (self): "Getting student Name. """ name_OK = False while not name_OK: instructor_name = input("Enter instructor name: ") if instructor_name: name_OK = True return instructor_name ";", ":", "[", "]", "{", "}", "\", "."] def isNameOK (self, passed_instructor_name): "Checking for bad_char in student name""" bad_chars = ["!", ', "@", "#", "$", "%", "A", "&", if passed_instructor_name: for character in passed_instructor_name: if character in bad_chars or character.isdigit(): print("Instructor name is incorrect. Please try again.") return false return True else: print("Instructor name is missing. Please try again.") return false 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 def getinstitution(self): """Getting Instructor last institution. "". institution_OK - False while not institution_OK: last_institution - input("Enter last institution: ") if last_institution: institution_OK = True return last_institution def getDegree(self): "Getting Instructor high degree.""" degree_OK = False while not degree_OK: high_degree = input("Enter highest degree: ") if high_degree: degree_OK = True return high_degree #Creatting college records my_validator - Validator college_records = [] while True: college_recorus = [] while True: user = (input("Please select type of user (Student/Instructor): ")) if user == "Instructor": Instructor_ID = my_validator.getinstructorID() Instructor_name = my_validator.getinstructorname) Instructor_email = my_validator.getEmail() Instructor_institution = my_validator.getinstitution) Instructor_degree = my_validator.getDegree() college_records.append(Instructor(Instructor_name, Instructor_ID, Instructor_email, Instructor_degree, Instructor_institution)) stop = input(" Do you want to quit? Y/N:") if stop == 'y' or stop == 'Y': for instructor in college_records: print("Your Instructor ID is " + Instructor_ID + "."+ "Hello, " + Instructor_name + "." + " Your email address is " + Instructor_email + "." + " Your last institution is " + Instructor_institution + "." + " Your high degree is " + Instructor_degree) break 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 elif user == "Student": student_ID = my_validator.getstudentID) student_name = my_validator.getstudentname() student_email = my_validator.getEmail() student_program - my_validator.getProgram) college_records.append(Student (student_ID, student_name, student_email, student_program)) stop = input(" Do you want to quit? Y/N:") if stop == 'y' or stop == 'Y': for student in college_records: print("Your Student ID is " + student_ID + "." + "Hello," + student_name + "." + " Your email address is " + student email + "and your program is + student_program + ".") break " for Individual in college_records: Individual displayinformation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!