Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python
Python
  1. วิธีติดตั้ง Tkinter ใน Python

    ติดตั้ง Tkinter ใน Python Tkinter เป็น Standard Library ใน Python สำหรับ GUI Application มี Controls หลากหลายสำหรับสร้าง GUI App มักติดตั้งมาพร้อม Python แล้ว ตอนติดตั้ง Python ให้ติ๊กเลือก tcl/tk and IDLE checkbox จะติดตั้ง Tkinter อัตโนมัติ ไม่ต้องติดตั้งแยก ขั้นตอนที่ 1: ตรวจสอบ Python และ pip

  2. Matrix ใน Python อธิบายพร้อมตัวอย่าง

    Matrix ใน Python คืออะไร? Matrix ใน Python คือ Two-dimensional Array (Array 2 มิติ) ที่มีจำนวน Rows และ Columns เฉพาะ ข้อมูลใน Matrix อาจเป็นตัวเลข String หรือ Symbols ก็ได้ Matrix หรือ Two-dimensional List เป็น Data Structure สำคัญ Operations ต่างๆ เช่น Transpose, Addition, Multiplication ของ Matr

  3. หา K Records ที่น้อยที่สุดจาก List of Tuples ใน Python

    Find Minimum K Records from Tuple List เมื่อต้องการหา K Records ที่มีค่าน้อยที่สุดจาก List of Tuples สามารถใช้ sorted() และ Lambda Function ได้ Lambda Function Anonymous Function กำหนดด้วย lambda รับ Argument ได้หลายตัว แต่มี Expression เดียว คืนค่าผลลัพธ์ของ Expression นั้น ตัวอย่างโค้ด my_list =

  4. หาค่าสูงสุดของ Column ที่ N จาก List of Tuples ใน Python

    Get Maximum of N-th Column from Tuple List เมื่อต้องการหาค่าสูงสุดของ Column ที่ N (Index N) จาก List of Tuples สามารถใช้ List Comprehension และ max() ได้ ตัวอย่างโค้ด my_list = [(67, 78, 39), (34, 23, 52), (99, 69, 78), (2, 11, 0)] print(The list is : ) print(my_list) N = 2 print(The value of N h

  5. หาความต่างน้อยที่สุดใน Tuple Pair ด้วย Python

    Get Minimum Difference in Tuple Pair เมื่อต้องการหาความต่างน้อยที่สุด (Minimum Difference) ระหว่างคู่ Element ใน List of Tuples สามารถใช้ min() และ List Comprehension ได้ ตัวอย่างโค้ด my_list = [(67, 78), (39, 34), (23, 52), (99, 69), (78, 2), (11, 0)] print(The list is : ) print(my_list) # คำนวณ

  6. Merge Sort ใน Python อธิบายพร้อมตัวอย่าง

    Merge Sort คืออะไร? Merge Sort เป็น Sorting Algorithm ที่มีประสิทธิภาพ Time Complexity O(n log n) โดยที่ n คือความยาวของ Array Merge Sort ใช้หลัก Divide and Conquer (แบ่งและเอาชนะ): แบ่ง Array ออกเป็น 2 ส่วนเท่าๆ กันซ้ำๆ จนเหลือ Element เดียว รวม (Merge) สorted sub-arrays กลับมาเป็น Array

  7. Object ใน Python คืออะไร อธิบายพร้อมตัวอย่าง

    Object ใน Python คืออะไร? Python เป็นภาษา Object-Oriented Programming (OOP) เกือบทุกอย่างใน Python ถือเป็น Object Object มี Properties (Attributes) และ Behaviors (Methods) ของตัวเอง Class คืออะไร? Class เป็น Blueprint (แม่แบบ) ของ Object หรือเรียกว่า Object Constructor สำหรับสร้าง Object หนึ่ง Clas

  8. วิธีแปลง Text เป็น Speech ใน Python

    Text to Speech ใน Python ด้วย gTTS การแปลง Text to Speech หมายถึงโปรแกรมที่รับ Input เป็น Text และ Output เป็น Speech (เสียงพูด) Python มี API สำหรับ Text-to-Speech หนึ่งในนั้นคือ Google Text-to-Speech (gTTS) สามารถแปลงข้อความเป็นเสียงและบันทึกเป็นไฟล์ Audio ได้ ขั้นตอนที่ 1: ติดตั้ง gTTS pip inst

  9. การต่อ String Tuple สองตัวใน Python

    Concatenation ของ String Tuple สองตัว เมื่อต้องการต่อ (Concatenate) String Tuple สองตัวแบบ Element-wise สามารถใช้ zip() และ Generator Expression ได้ ตัวอย่างโค้ด my_tuple_1 = (Jane, Pink, El) my_tuple_2 = (Will, Mark, Paul) print(The first tuple is : ) print(my_tuple_1) print(The second tuple is :

  10. การยกกำลัง Tuple ด้วย Tuple อีกตัวใน Python

    Raise Tuple Elements to Power of Another Tuple เมื่อต้องการยกกำลัง Element ของ Tuple ตัวหนึ่ง ด้วย Element ของ Tuple อีกตัว (Index ตรงกัน) ใช้ zip() และ Generator Expression พร้อม Operator ** ตัวอย่างโค้ด my_tuple_1 = (7, 8, 3, 4, 3, 2) my_tuple_2 = (9, 6, 8, 2, 1, 0) print(The first tuple is : )

  11. การทำ XOR Operation บน Tuple ใน Python

    Tuple XOR Operation ใน Python เมื่อต้องการทำ Operation XOR (Exclusive OR) บน Tuple สองตัวแบบ Element-wise สามารถใช้ zip() และ Generator Expression ได้ XOR Operator (^) ใน Python ใช้ ^ สำหรับ Bitwise XOR เปรียบเทียบ Bit ตรงกัน: ต่างกันให้ 1, เหมือนกันให้ 0 ตัวอย่างโค้ด my_tuple_1 = (7, 8, 3, 4, 3,

  12. วิธีติดตั้ง OpenCV ใน Python

    ติดตั้ง OpenCV ใน Python OpenCV (Open Source Computer Vision Library) เป็น Library สำหรับ Computer Vision ใช้ใน Machine Learning และ Image Processing เช่น รู้จักตัวเลขมือ เข้าใจใบหน้าและวัตถุ ขั้นตอนที่ 1: ตรวจสอบ Python และ pip เปิด Command Prompt รัน: ตรวจสอบ Python python --version ตรวจสอบ pip

  13. วิธีติดตั้ง Matplotlib ใน Python

    ติดตั้ง Matplotlib ใน Python Matplotlib เป็น Library สำหรับวาดกราฟ ใช้ใน Data Visualization และ Graphical Plotting ขั้นตอนที่ 1: ตรวจสอบ Python และ pip เปิด Command Prompt แล้วรัน: ตรวจสอบ Python python --version ถ้าติดตั้งแล้วจะแสดง Version ตรวจสอบ pip pip -V จะแสดง Version ของ pip ขั้นตอนที่ 2:

  14. วิธีแปลง List เป็น Dictionary ใน Python

    แปลง List เป็น Dictionary ใน Python List เป็นโครงสร้างข้อมูลเชิงเส้น Dictionary เป็นโครงสร้างข้อมูล Key-Value Pairs โดย Key ต้องไม่ซ้ำกัน ตัวอย่าง List: [1, 2, 3, 4, 5, 6] Dict: {1:2, 3:4, 5:6} # Index คู่เป็น Key, Index คี่เป็น Value วิธีที่ 1: ใช้ Loop วนลูป def convert(l): dic = {}

  15. การหาร Tuple แบบ Element-wise ใน Python

    Tuple Division (Element-wise) ใน Python เมื่อต้องการหาร Tuple สองตัวแบบ Element-wise (หารค่าที่ Index ตรงกัน) สามารถใช้ zip() และ Generator Expression ได้ Operator // (Floor Division) ใช้ // สำหรับการหารแบบปัดทิ้งเศษ (Floor Division) คืนค่า Integer ตัวอย่างโค้ด my_tuple_1 = (7, 8, 3, 4, 3, 2) my_t

  16. วิธีพัฒนาเกมใน Python ด้วย PyGame

    พัฒนาเกมใน Python ด้วย PyGame สามารถพัฒนาเกมใน Python ได้โดยใช้ PyGame ซึ่งเป็น Module สำหรับพัฒนาเกม รวม Computer Graphics และ Sound Libraries ที่ใช้ในการพัฒนา Video Game ขั้นตอนที่ 1: ติดตั้ง PyGame ก่อนติดตั้ง PyGame ควรมี Python และ pip ติดตั้งไว้ในระบบแล้ว เปิด Terminal แล้วรันคำสั่ง: py -m pi

  17. การกรอง Tuple ด้วย K-th Element จาก List ใน Python

    Filter Tuples by K-th Element from List เมื่อต้องการกรอง Tuple จาก List of Tuples โดยใช้ K-th Element ตรวจสอบกับ List อีก List หนึ่ง สามารถใช้ List Comprehension และ Operator in ได้ คำอธิบาย List of Tuple = List ที่แต่ละ Element เป็น Tuple Operator in ตรวจสอบว่าค่าอยู่ใน Iterable หรือไม่

  18. การสร้าง Tuple จาก String และ List ใน Python

    Create Tuple from String and List เมื่อต้องการสร้าง Tuple จาก String และ List สามารถใช้เมธอด tuple() ได้ List เก็บข้อมูลหลายชนิดได้ List สามารถเก็บข้อมูลประเภทต่างๆ ได้ (Integer, Float, String, etc.) ตัวอย่างโค้ด my_list_1 = [Hey, there, How, are, you] my_list_2 = Jane print(The first list is :)

  19. วิธีสร้าง GUI อัปเดตอัตโนมัติด้วย Tkinter ใน Python

    สร้าง GUI ที่อัปเดตอัตโนมัติด้วย Tkinter GUI Window มี Controls หลายอย่าง เช่น Labels, Buttons, Text Boxes บางครั้งเราต้องการให้เนื้อหาของ Controls (เช่น Label) อัปเดตอัตโนมัติขณะที่กำลังดูหน้าต่าง ใช้ after() สำหรับการเรียกซ้ำ เมธอด after(ms, func) ใช้เรียก Function หลังจากเวลาที่กำหนด (Millisecon

  20. การสร้าง Tuple เพิ่มทีละ N Element ใน Python

    สร้าง N-Element Incremental Tuples เมื่อต้องการสร้าง Tuple ที่แต่ละ Element เป็น Tuple ย่อยที่มีค่าเพิ่มขึ้นทีละ N สามารถใช้ Generator Expression และ tuple() ได้ ตัวอย่างโค้ด N = 3 print(The value of N has been initialized) print(The number of times it has to be repeated is : ) print(N) # สร้าง Tu

Total 9001 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:241/451  20-คอมพิวเตอร์/Page Goto:1 235 236 237 238 239 240 241 242 243 244 245 246 247