0% found this document useful (0 votes)
10 views2 pages

Week 7

Uploaded by

shibnariyas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Week 7

Uploaded by

shibnariyas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

class Student:

email_domain= "solla.sollew.edu"

student_dir = "/user/student"

def __init__(self,id,first_name,last_name):

#none changeable

self.id=id

self.first_name=first_name

self.last_name=last_name

self.username=first_name[0].lower()+last_name[0].lower() +id[0:3]

#FUNCTIONS ARE CHANGEMBLE

def fullname(self):

return "{0} {1}".format(self.first_name,self.last_name)

def email(self):

return self.username+"@"+Student.email_domain

def email_alias(self):

return self.first_name+'.'+self.last_name+'.'+self.id[0:3]+'@'+Student.email_domain

def home_dir(self):

return Student.student_dir+"/"+self.username

def print_detail(self):

print("Student ID: " + self.id)

print("First name: " + self.first_name)

print("Last name: " + self.last_name)

print("Full name: " + self.fullname())

print("Username: " + self.username)

print("Email: " + self.email())

print("Email alias: " + self.email_alias())


print("Home directory: " + self.home_dir())

#--------------------------x----------------------------------------------------------------

# main

student1=Student('0973427','John','Smith')

student2=Student('1882845','Mary','Wilson')

student3 = Student('0729032','Ye','Yang')

print('Before:')

student2.print_detail()

student2.last_name='Davis'

print()

print("After:")

student2.print_detail()

You might also like