OOP Learning by Most
Project description
วิธีติดตั้ง
เปิด CMD / Terminal
pip install mostoop
วิธีใช้
[STEP 1] - เปิด IDLE ขึ้นมาแล้วพิมพ์…
from mostoop import student,special_student,tesla,teacher
#day0
allstudent=[]
teacher1 = teacher('Ada Lovelace')
teacher2 = teacher('Bill Gates')
print(teacher1.student)
#day 1
print('--------Day1------')
st1 = student('Albert','Einstein')
allstudent.append(st1)#สมัครเก็บไว้ในlist
teacher1.add_student(st1)
print(st1.fullname)
#day2
print('--------Day2------')
st2= student('Thanapat','Wichiankanyarat')
allstudent.append(st2)
teacher2.add_student(st2)
print(st2.fullname)
#day3
print('--------Day3------')
for i in range(3):
st1.Codeing()
st2.Codeing()
st1.showxp()
st2.showxp()
#day4
print('--------Day4------')
stp1 = special_student('Thomas','Edison','Hitler')
allstudent.append(stp1)
teacher1.add_student(stp1)
print(stp1.fullname)
print('คุณครูครับ ขอคะแนนฟรี 20 คะแนน')
stp1.exp=20 #แก้ไขค่าในclass
stp1.Codeing()
stp1.showxp()
print('--------Day5------')
print('นักเรียนกลับบ้านยังไง?')
print(allstudent)
for st in allstudent:
print('{} กลับบ้านด้วย {}'.format(st.name,st.vehicle))
if isinstance(st,special_student):#isinstance เป็นการcheckว่า st อยู่ในคลาส special_student รึเปปล่า
st.vehicle.selfdriving(st)#st.vechicle มาจาก class student self.vehicle ตัวselfคือ st ส่วน selfของ selfdriving คือ st.vehicle
#day 6
print('-----------Day6---------')
teacher1.checkstudent()
teacher2.checkstudent()
print('รวมพลัง 2 คน {}'.format(st1+st2))
พัฒนาโดย: Thanapat Wichiankanyarat FB: https://www.facebook.com/thanapat.wichiankanyarat/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mostoop-0.0.3.tar.gz
(3.9 kB
view details)
File details
Details for the file mostoop-0.0.3.tar.gz
.
File metadata
- Download URL: mostoop-0.0.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f5a2615b4b57bcd70b5bc3bb90461148671ea8950d1f2380ca238b303a5c073 |
|
MD5 | dfbc43c992701605e00c56911e9ea3ba |
|
BLAKE2b-256 | ae37fc940e8fea61e84be98213863b8ce518972d617aee1f4bf8ccedbe194a77 |