-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsession-on-class.py
72 lines (46 loc) · 1.64 KB
/
session-on-class.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class Employee():
def __init__(self, name, age):
self.name = name
self.age = age
self.pi = 3.142
# wrong way for gettting employee name from the object.
# def getEmployeeName(self, inputFromUser):
# print("Employee name is ", inputFromUser)
def getNewEmployeeName(self):
print("new employee name is ", self.name)
def getEmployeeAge(self):
print(self.name + "'s age is " + self.age)
import random
class Bank():
def __init__(self, name, age, dob, address):
self.name = name
self.age = age
self.dob = dob
self.address = address
self.accountNumber = random.randint(1,1000)
self.accountBalance = 0
print("Your account got created, " + self.name)
def getCustomerAccountInfo(self):
print("Hello " + self.name)
print("Your account got created, here's your account number " , str(self.accountNumber))
print("Your current balance of your account is ", str(self.accountBalance))
def getMyBirthDate(self):
print('Hello ' + self.name + ' you birthday is ' + self.dob)
ramIsTheCustomer = Bank('Ram', 26, '1/1/2020', 'London')
ramIsTheCustomer.getCustomerAccountInfo()
ramIsTheCustomer.getMyBirthDate()
ram = Employee("Ram")
san = Employee("Sanjay")
print(ram)
print("--------")
# print(ram.getEmployeeName("Ram"))
ram.getNewEmployeeName()
san.getNewEmployeeName()
sanjay.getEmployeeAge()
class EmployeeV2():
def __init__(self, name, age, sex):
self.name = name
self.age = age
self.sex = sex
def getEmployeeName(self):
return("Employee name is " + self.name)