1. Trang chủ
  2. » Công Nghệ Thông Tin

GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG

74 39 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Giáo Trình Thực Hành Môn Công Nghệ Mới Trong Phát Triển Ứng Dụng
Tác giả ThS. Tôn Long Phước
Trường học Trường Đại Học Công Nghiệp Tp.Hcm
Chuyên ngành Khoa Học Máy Tính
Thể loại Giáo Trình
Năm xuất bản 2017
Thành phố Tp.Hcm
Định dạng
Số trang 74
Dung lượng 7,39 MB

Cấu trúc

  • Phần 1: Làm quen với ngôn ngữ Python (4)
  • Phần 2: Machine learning & Cloud Computing (13)
  • Phần 3: Internet of Things (IoT) (24)
  • Bài 1: Lập trình với Keypad & Led (24)
  • Bài 2: Lập trình với Led & Button (48)
  • Bài 3: Lập trình với Keypad & LCD (54)
  • Bài 4: Lập trình với Keypad, Buzz, Led (59)
  • Bài 5: Lập trình với Led và Wi-Fi (65)

Nội dung

Làm quen với ngôn ngữ Python

• Cài đặt chương trình soạn thảo đơn giản cho Python

• Thực hành viết chương trình đơn giản trên Python

• Thực hành các toán tử trong ngôn ngữ lập trình Python

Công cụ soạn thảo Python

Create a program that prompts users to input textbook prices and calculates the extent to which these prices are overpriced Utilize the input command to gather data from the user, and apply the round command to ensure numerical accuracy The program should then display the results in a clear and concise manner, highlighting the overpricing of textbooks.

- How much do you want to pay for each textbook? 50

- How much did the average textbook actually cost? 80

- How many books did you buy? 5

- Each book is overpriced by $30 ( 60% )

- You got ripped off by $150 total

You may assume that the user enters a positive integer for each input value above

When purchasing a house, it's crucial to understand your monthly loan payment Create a comprehensive program that gathers essential loan information and calculates the monthly payment, providing you with clear financial insights.

To calculate monthly mortgage payments, you need to consider the loan amount, the total number of months (n), and the monthly interest rate (c) The payment can be determined using a specific formula that incorporates these values.

An example run of your program might produce the following output (user input is underlined):

- This program computes monthly loan payments

When processing loan calculations, it's crucial to ensure that the input numbers are correctly interpreted The loan term should be entered in months rather than years, and the interest rate must be converted from a yearly percentage to a monthly decimal For instance, an interest rate of 6.75% should be adjusted to 0.005625 by dividing by 12 and then by 100 These conversions are essential for accurate program functionality.

3 Write a program that counts a number's factors and determines whether the number is prime

- What is your favorite number? 24

- What is your favorite number? 31

To determine the factors of an integer n, employ a loop that checks each integer less than n for divisibility This method effectively identifies which integers can divide n without leaving a remainder.

• Thực hành các nhập xuất chuỗi, số trên Python

• Thực hành các câu lệnh rẽ nhánh, lặp…trên Python

Công cụ soạn thảo Python

Credit card numbers contain essential information for validity checks, such as the fact that Visa card numbers always start with the digit 4 To ensure a Visa card number is valid, it must also pass the Luhn checksum algorithm, which requires the sum of the digits to be a multiple of 10 Before final verification with the credit card company, systems that accept credit cards conduct a Luhn test to filter out fake or incorrectly entered card numbers.

To sum the digits of a credit card number, assign a zero-based index to each digit, starting with the first digit at index 0 and the last digit at the highest index This algorithm efficiently processes the credit card digits for calculations.

To implement the Luhn algorithm, begin processing the credit card number from the rightmost digit For digits located at even-numbered indexes, simply add their value to a cumulative sum For odd-numbered indexes, double the digit's value; if the result is less than 10, add it directly to the sum If the doubled value is 10 or greater, separate it into its individual digits and add each one to the sum This method ensures accurate validation of credit card numbers through a systematic approach to digit manipulation.

The credit card numbers 4111111111111111 and 4408041254369873 successfully pass the Luhn algorithm, which is designed to validate card numbers In this process, digits at even indexes are doubled, and if the result exceeds 10, it is split into individual digits for summation For instance, the digit 7 at index 8 is doubled to 14, which is then split into 1 and 4 for calculation purposes.

An example checksum using the Luhn algorithm

70 is divisible by 10, therefore this card number is valid

Write a program where the user can type in a credit card number and receive a message stating whether the number was valid

• Thực hành các xử lý file (đọc, thống kê) trên Python

• Thao tác trực tiếp File dữ liệu (ghi, ghi file cấu trúc) trên Python

Công cụ soạn thảo Python

Suppose we have this hours.txt data:

Compute each worker's total hours and hours/day

- Assume each worker works exactly five days

- Suzy ID 123 worked 31.4 hours: 6.3 / day

- Brad ID 456 worked 36.8 hours: 7.36 / day

- Jenn ID 789 worked 39.5 hours: 7.9 / day input = open("hours.txt") for line in input: id, name, mon, tue, wed, thu, fri = line.split()

# cumulative sum of this employee's hours hours = float(mon) + float(tue) + float(wed) + \ float(thu) + float(fri) print(name, "ID", id, "worked", \ hours, "hours: ", hours/5, "/ day"

• Thực hành các hàm đồ họa cơ bản trên Python

• Cách trình diễn các đối tượng đồ họa cơ bản

Công cụ soạn thảo Python

To create a graphical interface using the DrawingPanel library, start by importing the module and initializing a panel with specified dimensions, such as 400 by 300 pixels Set the background color to yellow, then draw a rectangle with coordinates (100, 50) to (200, 300) Additionally, create another rectangle with an outline in red and a yellow fill, using coordinates (100, 50) to (200, 200) Finally, draw a blue oval with the specified coordinates (20, 10) to (180, 70).

10 panel = DrawingPanel(200, 200) panel.canvas.create_polygon(100, 50, 150, 0,

150, 100, fill="green") panel.canvas.create_line(10, 120, 20, 160,

DrawingPanel panel = new DrawingPanel(200, 200); panel.setBackground(Color.LIGHT_GRAY);

Graphics g = panel.getGraphics(); g.setColor(Color.BLACK); // body g.fillRect(10, 30, 100, 50); g.setColor(Color.RED); // wheels g.fillOval(20, 70, 20, 20); g.fillOval(80, 70, 20, 20); g.setColor(Color.CYAN); // windshield g.fillRect(80, 40, 30, 20);

• Thực hành các hàm đồ họa trên Python

• Sử dụng các cấu trúc đồ họa phức tạp

Công cụ soạn thảo Python

1 Write a program that draws the following figure:

2 Write a program that draws the following figure:

Part of the challenge is using loops to reduce the redundancy of the figure

3 Write a program that draws the following figure:

Part of the challenge is using loops to reduce the redundancy of the figure

Machine learning & Cloud Computing

Bài thực hành số 1: Cài đặt môi trường triển khai ứng dụng machine-learning trên windows azure

• Cài đặt được bộ free Microsoft Azure ML workspace

• Cấu hình được Setup Azure ML workspace với existing Azure subscription

• Cài đặt Python cho môi trường phát triển

• Cài đăth công cụ R phần thống kê

Chuẩn bị tài nguyên (phần mềm, internet, máy tính)

Chi tiết: Đăng ký tài khoản free tại

• Microsoft Account (signup at https://signup.live.com)

Cài đặt phần mềm R_Studio https://cran.rstudio.com hoặc https://www.rstudio.com/products/rstudio/download/

Cài đặt Python từ https://www.continuum.io/downloads

Bài thực hành số 2: Giới thiệu R và xử lý dữ liệu với Python

• Sử dụng được công cụ R vào ứng dụng thống kê trên dữ liệu

• Dùng được các hàm thống kê trong Python

Yêu cầu: Đã cài đặt các công cụ ở buổi 6

# Generate a numeric series from 1 to 30 and assign it to variable x x

Ngày đăng: 10/12/2021, 14:11

HÌNH ẢNH LIÊN QUAN

Hình 4: Đặt tên cho file mô tả thiết bị. - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 4 Đặt tên cho file mô tả thiết bị (Trang 27)
Hình 6: Đặt tên file mô tả ứng dụng. - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 6 Đặt tên file mô tả ứng dụng (Trang 29)
Hình 9: Mở file mô tả thiết bị bằng giao diện đồ họa. - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 9 Mở file mô tả thiết bị bằng giao diện đồ họa (Trang 31)
Hình 10: Giao diện mô tả thiết bị. - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 10 Giao diện mô tả thiết bị (Trang 32)
Hình 13: Cài đặt thông số cho đèn LED 1 - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 13 Cài đặt thông số cho đèn LED 1 (Trang 33)
Hình 15: Cài đặt thông số cho đèn LED 3 - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 15 Cài đặt thông số cho đèn LED 3 (Trang 34)
Hình 16: Mở file đặc tả bằng giao diện đồ họa. - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 16 Mở file đặc tả bằng giao diện đồ họa (Trang 35)
Hình 17: Giao diện đồ họa đặc tả ứng dụng. - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 17 Giao diện đồ họa đặc tả ứng dụng (Trang 36)
Hình 18: Đặc tả cho bài toán trên. - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 18 Đặc tả cho bài toán trên (Trang 36)
Hình 23: Mã nguồn được phát sinh phần 2 - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 23 Mã nguồn được phát sinh phần 2 (Trang 39)
Hình 24: Mã nguồn sau khi phát sinh phần 3 - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 24 Mã nguồn sau khi phát sinh phần 3 (Trang 40)
Hình 27: Mở File mã vừa phát sinh - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 27 Mở File mã vừa phát sinh (Trang 43)
Hình 28: Kết nối thiết bị thực tế - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 28 Kết nối thiết bị thực tế (Trang 45)
Hình 30: Trạng thái khi nhấn nút số 1 - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 30 Trạng thái khi nhấn nút số 1 (Trang 46)
Hình 38: Mã nguồn được phát sinh phần 3. - GIÁO TRÌNH THỰC HÀNH MÔN CÔNG NGHỆ MỚI TRONG PHÁT TRIỂN ỨNG DỤNG
Hình 38 Mã nguồn được phát sinh phần 3 (Trang 52)

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w