The following is the contents of the python file "student.py": # Name: [your name] # email: [your Seneca Email address] class Student: def __init__(self, name, number, program): programs = ['CNS', 'CTY'] self.name = name self.number = number self.courses = {} if program in programs: self.program = program else: self.program = 'unknown' def displayStudent(self): result = 'Student: ' result += self.name result += '\n' result += 'Student ID: ' result += self.number return result Ques: Update the Class definition of Student in "student.py". Typing the following into the python interpreter should produce the following result: >>>> import student >>>> dave = student.Student('David', '01234', 'CTY') >>>> dave + 'uli101' >>>> print(dave.get_courses()) uli101: 0.0 >>>> dave + 'ops235' >>>> print(dave.get_courses()) uli101: 0.0 ops235: 0.0 Subject: Python Programming
The following is the contents of the python file "student.py":
# Name: [your name]
# email: [your Seneca Email address]
class Student:
def __init__(self, name, number, program):
programs = ['CNS', 'CTY']
self.name = name
self.number = number
self.courses = {}
if program in programs:
self.program = program
else:
self.program = 'unknown'
def displayStudent(self):
result = 'Student: '
result += self.name
result += '\n'
result += 'Student ID: '
result += self.number
return result
Ques: Update the Class definition of Student in "student.py". Typing the following into the python interpreter should produce the following result:
>>>> import student
>>>> dave = student.Student('David', '01234', 'CTY')
>>>> dave + 'uli101'
>>>> print(dave.get_courses())
uli101: 0.0
>>>> dave + 'ops235'
>>>> print(dave.get_courses())
uli101: 0.0
ops235: 0.0
Subject: Python
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images