-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpro_class_1.py
More file actions
59 lines (49 loc) · 1.47 KB
/
pro_class_1.py
File metadata and controls
59 lines (49 loc) · 1.47 KB
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
# class progammer:
# def __init__(self,name,lang,salary):
# print("GOGGLE :")
# self.name = name
# self.lang = lang
# self.salary = salary
# adi = progammer("Adithyan","python",1900000)
# print(adi.name,adi.lang,adi.salary)
# vig = progammer("vig","RUST",1700000)
# print(vig.name,vig.lang,vig.salary)
# class claculator:
# def __init__(self,n):
# print("the value of root : ")
# self.n = n
# @staticmethod
# def info():
# print("hello bro!!")
# def square(self):
# print(f"the square is {self.n*self.n}")
# def cube(self):
# print(f"the cube is {self.n*self.n*self.n}")
# def squareRoot(self):
# print(f"the square root is {self.n** 1/2}")
# a = claculator(73)
# a.info()
# a.square()
# a.cube()
# a.squareRoot()
# class demo:
# a = 5
# object = demo()
# object.a = 2
# print(object.a)
# print(demo.a)
# railway booking system :
from random import randint
class train:
def __init__(self,trainno):
self.trainno = trainno
def bookslot(self,frm,to):
print(f"the train no. is booked in {self.trainno} the destiny is {frm} to {to}")
def status(self):
print(f"the train status of {self.trainno} is reaching to us")
def fairprice(self,frm,to):
print(f"the train no. is {self.trainno} the destiny is {frm} to {to} the price is {randint(250,550)}")
t = train(129577)
t.bookslot("bangaluru","kerala")
t.status()
t.fairprice("bangaluru","kerala")