Skip to main content

Learning by oattao123

Project description

Python OOP+ วิธีสร้าง Library เป็นของตัวเอง+ อัพโหลด Package ไปยัง PyPI.org

โปรแกรมนี้ลุงใช้สำหรับสอนการเขียนโปรแกรมแบบ OOP สามารถดูตัวอย่างคลิปวิดีโอที่สอนได้ใน: https://youtu.be/1egtTXUJ3-4

วิธีติดตั้ง

เปิด CMD / Terminal

pip install oopschool

วิธีใช้งานแพ็คเพจนี้

  • เปิด IDLE ขึ้นมาแล้วพิมพ์…

from oopschool import Student,Tesla,SpecialStudent,Teacher
allstudent = []

teacher1 = Teacher('Ada Lovelace')
teacher2 = Teacher('Bill Gates')
print(teacher1.students)

# Day 1
print('-----Day 1----')
st1 = Student('Albert','Einstein')
allstudent.append(st1) #สมัครเสร็จเก็บไว้ในลิสต์นักเรียนทันที
teacher2.AddStudent(st1)
print(st1.fullname)

# Day 2
print('-----Day 2----')
st2 = Student('Steve','Jobs')
allstudent.append(st2)
teacher2.AddStudent(st2)
print(st2.fullname)

# Day 3
print('-----Day 3----')
for i in range(3):
    st1.Coding()

st2.Coding()
st1.ShowEXP()
st2.ShowEXP()

# Day 4
print('-----Day 4----')

stp1 = SpecialStudent('Thomas','Edison','Hitler')
allstudent.append(stp1)
teacher1.AddStudent(stp1)
print(stp1.fullname)
print('คุณครูครับ ขอคะแนนฟรีสัก 20 คะแนนได้ไหม')
stp1.exp = 20 # แก้ไขค่าในคลาสได้
stp1.Coding()
stp1.ShowEXP()

# Day 5
print('-----Day 5----')
print('นักเรียนกลับบ้านยังไงจ๊ะ?')
print(allstudent)
for st in allstudent:
    print('ผม: {} กลับบ้านด้วย {} ครับ'.format(st.name,st.vehicle))
    if isinstance(st,SpecialStudent):
        st.vehicle.SelfDriving(st)
# Day 6
print('-----Day 6----')

teacher1.CheckStudent()
teacher2.CheckStudent()

print('รวมพลังของนักเรียน 2 คน ', st1 + st2 )

พัฒนาโดย: ลุงวิศวกร สอนคำนวณ FB: https://www.facebook.com/UncleEngineer YouTube: https://www.youtube.com/UncleEngineer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysortcsv-0.0.1.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file pysortcsv-0.0.1.tar.gz.

File metadata

  • Download URL: pysortcsv-0.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for pysortcsv-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bc17e9659ff51804bd51bbc6610f2f6374036d437b47022868675e8bb2c7c3fb
MD5 05c79e89e587bc01bf198ee930efbfe7
BLAKE2b-256 79914d576db257dad77728d25f427e8702b13d1f1cc0e691c32eeab357963cb1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page