Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore ภาษา Python

ภาษา Python

Published by Guset User, 2022-02-07 04:41:19

Description: ภาษา Python (2)

Search

Read the Text Version

ภาษา Pytho n

ประวัติ ภาษา python ภาษา Python กำเนิดขึ้นในปลายปี 1980 และการ พัฒนาของมันเริ่มต้นในเดือนธันวาคม 1989 โดย Guido van Rossum ที่ Centrum Wiskunde & Informatica (CWI) ในประเทศเนเธอร์แลนด์ เนื่องในผู้ ประสบความสำเร็จในการสร้างภาษา ABC ที่มีความ สามารถสำหรับการจัดการข้อผิดพลาด (Exception handling) และการติดต่อผสานกับระบบปฏิบัติการ Amoeba ซึ่ง Van Rossum นั้นเป็ นผู้เขียนหลักของ ภาษา Python และเขาทำหน้าเป็ นกลางในการตัดสินใจ สำหรับทิศทางการพัฒนาของภาษา Python

Python 2.0 ได้ถูกเผยแพร่ ในวันที่ 16 ตุลาคม 2000 และมีคุณสมบัติใหม่ที่โดดเด่น ที่ประกอบไปด้วย cycle- detecting garbage collector และสนับสนุน Unicode กับการเผยแพร่ครั้ง นี้ กระบวนการพัฒนานั้นได้ เปลี่ยนไปโดยการร่วมกัน พัฒนาด้วย Community มาก ขึ้น

Python 3.0 (ซึ่งได้มีการพัฒนามาก่อน หน้านี้และได้อ้างถึงโดยใช้ชื่อว่า Python 3000 หรือ py3k) มันเป็ นการพัฒนาที่ เปลี่ยนแปลงไปอย่างมาก และมันเข้ากัน กับ Python ในเวอร์ชันก่อนหน้าไม่ได้ ซึ่ง ได้ถูกเผยแพร่ในวันที่ 3 ธันวาคม 2008 หลังจากที่ได้มีการทดสอบอยู่เป็ นเวลานาน คุณสมบัติที่สำคัญของมันจำนวนมากได้ ถูกย้อนกลับไปเพื่อให้เข้ากันได้กับ Python เวอร์ชัน 2.6.x และ 2.7.x

ประโยชน์ ภาษา python 1. ง่ายต่อการเรียนรู้ 2. นำไปใช้งานจริงได้ 3. มีไลบรารีครอบคลุมการใช้งานต่าง ๆ 4. งานทางด้านวิทยาศาสตร์ข้อมูล 5. เขียนโปรแกรมได้หลายกระบวนทัศน์ (Multi-paradigms programming) 6. มีชุมชนนักพัฒนาที่แข็งแกร่ง 7. ทำงานได้หลายแพลตฟอร์ม 8. สามารถนำไปใช้งานได้ฟรี

โค้ดคำสั่งต่างๆ คำสั่ง if if expression: # statements n = 10 if n == 10: print('n equal to 10') logged_in = False if not logged_in: print('You must login to continue') m=4 if m % 2 == 0 and m > 0: print('m is even and positive numbers') if 3 > 10: print('This block isn\\'t executed') ผลลัพธ์ n equal to 10 You must login to post m is even and positive numbers

คำสั่ง if else n=5 if n == 10: print('n equal to 10') else: print('n is something else except 10') name = 'James' if name == 'Mateo': print('Hi, Mateo.') else: print('Who are you?') money = 300 if money >= 350: print('You can buy an iPad') else: print('You don\\'t have enough money to buy an iPad') ผลลัพธ์ n is something else except 10 Who are you? You don't have enough money to buy an iPad

คำสั่ง if elif print('Welcome to marcuscode\\'s game') level = input('Enter level (1 - 4): ') if level == '1': print('Easy') elif level == '2': print('Medium') elif level == '3': print('Hard') elif level == '4': print('Expert') else: print('Invalid level selected') ผลลัพธ์ Welcome to marcuscode's game Enter level (1 - 4): 4 Expert Welcome to marcuscode's game Enter level (1 - 4): 7 Invalid level selected

จัดทำโดย นาย ธนาเกียรติ ก๋าสม เลขที่9 ชั้นม.6/5 Tanakaet.008@ gmail.com นางสาว สุพพรรณนิกา จิตต์มุง เลขที่22 ชั้นม.6/5 suphrrnnikacittmung5@ gmail.com http://marcuscode.com/lang/python/introduction


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook