Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #في بايثون ٣ يكتب الكلاس بدون اقواس وتسخدم الاقواس ف حالة الوراثة
- class b :
- def s(self,x,y):#لابد من كتابة كلمة self
- return x+y
- bb=b()#هنا اشتقينا كائن من الكلاس
- print(bb.s(8,9))
- class v:
- def f(self):
- x=input("enter the name \n")
- y=int(input("enter the age\n"))
- if y >0 and y <20:
- print( x, "your boy")
- elif y>20 and y<30:
- print (x,"your sham")
- elif y>30 and y<40:
- print(x,"you old")
- else:
- print("not")
- dd=v()
- dd.f()
Add Comment
Please, Sign In to add comment