Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lesson 7 part 2
# Object Oriented Programming ''' 1. Create a Class called Student 2. Instantiate an object of the class (create an example of the class) 3. Student(): attribute: first name attribute: last name attribute: email address Class: Student() Object: std_1, std_2, ... Constructor: def __init__(self Attributes: first, last, email, UIN ''' # University, Chemistry Course [40 students] class Student: def __init__(self, first, last, UIN): # constructor self.first = first self.last = last self.email = first + '.' + last + '@email.com' self.UIN = UIN def fullname(self): return '{} {}'.format(self.first, self.last) def foo2(): pass def foo3(): pass # 'std_1' is an object for my class 'Student' std_1 = Student('Ali','Ahmed',100) std_2 = Student('Noor','Fatima',201) std_3 = Student('Shaikha','Ahmed',152) std_4 = Student('James','White',183) std_5 = Student('John','Hutch',104) std_6 = Student('Jim','Rogers',405) std_7 = Student('Little','Stuart',206) print (std_1.fullname()) class Employee: def __init__(self, first_name, last_name, salary): self.first = first_name self.last = last_name self.email = first_name + '.'+ last_name +' @email.com' self.pay = salary ''' Answer the following: 1. What's the name of the class? Employee 2. What's the constructor? __init__ 3a. How many arguments does the constructor take? 4 3b. How many arguments are passed to the object of the class? 3 4. How many attributes are there? List them out. self.first = self.last = self.email = self.pay = 5. Fill up the missing statements from lines 41-44 6. Create an object of the class. And run the code. 7. Who is the object for the class? emp_1 ''' emp_1=Employee('Faiha','AlQahtani',10000) #print(emp_1.first)
run
|
edit
|
history
|
help
0
3-6.격자판 최대합
Pytest
PyNoneOr
shivareddy correct
Add missing names
PYTHON 3 ÖDEV :)
python_study_note_for loop@nested loop
prog1.py
if else
Fig