Bài đăng
Đang hiển thị bài đăng từ Tháng 10, 2017
1. Full stack vs back end, fron-end develop
- Nhận đường liên kết
- X
- Ứng dụng khác
Xây dựng web và hiển thị trên nhiều thiết bị khác nhau bao gồm các thiết bị di động, mày tính, laptop, máy tính bảng. Front-end technologies: HTML, CSS, JS Back-end development: lưu trữ cá nhân hóa thông tin của người dùng trên sever và không hiển htị nó trước mặt người dùng. Web stack: collection of tools used for web development Front-end is master of HTML, Information architecture (IA): structural design of a website’s navigation (Đại loại như là kiến trúc thông tin) DOM: Document Object Model - describes the structure of the page and it's sort of like an outline or a map User experience (UX) and UI (user inteface) CSS cascading style sheet: 1. CSS is about defining a set of rules, or style sheets, for how the DOM translate in to visual form. 2, a set of rules that describe the priority of how the styles are rendered on a page. Defining colors sizes, fonts, applying traditional design concepts (contrast, alignment, proximity, ...) ...
Chương 12: Bộ - 12. Tuples
- Nhận đường liên kết
- X
- Ứng dụng khác
Bộ Tuples là kiểu dữ liệu không thay đổi. Đây là 1 dãy các giá trị. Các giá trị có thể thuộc kiểu dữ liệu bất kì, chúng được đánh thứ tự bởi các số nguyên. >>> t = 'a', 'b', 'c', 'd', 'e' Có thể bao lại trong ngoặc >>> t = ('a', 'b', 'c', 'd', 'e') Chú ý: t = 'a', --> Có dấu phẩy ở sau thì là tuples còn nếu ko có dấu phẩy thì là str t = ('a',) = ('a'), --> tuples hoặc dùng hàm có sẵn định nghĩa: >>> t = tuple() >>> print t () >>> t = tuple('lupins') >>> print t ('l', 'u', 'p', 'i', 'n', 's') Toán tử ngoặc vuông chỉ định 1 phần tử của bộ >>> t = ('a', 'b', 'c', 'd', 'e') >>> print t[0] 'a'
Chương 11: Từ điển - chưa xong đâu
- Nhận đường liên kết
- X
- Ứng dụng khác
Từ điển giống như danh sách, nhưng các chỉ số có thể (gần như) bất kì dữ liệu nào. Từ điển có các cặp: khóa - giá trị. và đôi khi được gọi là mục. Hàm dict sẽ tạo ra một từ điển mới mà không có mục nào. >>> eng2sp = dict() >>> print eng2sp {} >>> eng2sp['one'] = 'uno' >>> print eng2sp {'one': 'uno'} >>> eng2sp = {'one': 'uno', 'two': 'dos', 'three': 'tres'} Các thứ tự mục không giữ nguyên nhưng không quan trọng bởi vì chúng ta cần phải có từ khóa để tra tìm gái trị tương uuwnsg. Hàm len có tác dụng trên từ điển để thống kê số lượng khóa - trị. Toán tử in cũng có tác dụng cho chúng ta biết liệu 1 khóa có trong từ điển với tên gọi cho trước không (chứ không phải là giá trị) >>> 'one' in eng2sp True >>> 'uno' in eng2sp False Để tra giá trị thì chúng ta sử dụng phương thức sau: >>> vals = eng2sp.value...
Chương 10: Danh sách
- Nhận đường liên kết
- X
- Ứng dụng khác
Danh sách là 1 dãy các giá trị. Các giá trị trong 1 danh sách được gọ là phần tử. Sử dụng ngoặc vuông để xác định danh sách - chúng có khả năng lồng ghép với nhau. >>> cheeses = ['Cheddar', 'Edam', 'Gouda'] >>> numbers = [17, 123] >>> empty = [] >>> print cheeses, numbers, empty ['Cheddar', 'Edam', 'Gouda'] [17, 123] [] Các phần tử trong 1 danh sách cũng có thể được gắn nhãn bắt đầu tư số 0 để truy cập >>> print cheeses[0] Cheddar Các phần tử trong 1 danh sách có thể thay đổi được. >>> numbers = [17, 123] >>> numbers[1] = 5 >>> print numbers [17, 5] Các chỉ số trong dãy cũng có tác dụng như chỉ số của chuỗi: Bất kì một biểu thức số nguyên nào cũng có thể được dùng làm chỉ số. Nếu bạn cố gắng đọc hoặc ghi một phần tử mà bản thân nó không tồn tại, bạn sẽ gặp phải lỗi IndexError . Nếu một chỉ số có giá trị âm, nó sẽ được đếm ngược từ phía cuối danh s...
Chương 8: Chuỗi kí tự
- Nhận đường liên kết
- X
- Ứng dụng khác
Đây là 1 danh sách có thứ tự - truy đến từng ký tự bằng cách dùng toán tử ngoặc vuông: >>> fruit = 'banana' >>> letter = fruit[1] 2. ký tự đầu tiên của chuỗi kí tự được tính là 0 3. Hàm "len" là hàm để đếm số kí tự trong chuỗi. Để lấy ký tự cuối cùng trong chuỗi >>> last = fruit[length-1] >>> print last Duyệt vòng lặp for index = 0 while index < len(fruit): letter = fruit[index] print letter index = index + 1 Vòng lặp này sẽ hiển thị lần lượt từng kí tự trong chuỗi trên mỗi 1 dòng khác nhau. for char in fruit: print char (cái này cũng tương tự như lệnh ở trên. for char in fruit: print char Cắt chuỗi: >>> s = 'Monty Python' >>> print s[0:5] Monty >>> print s[6:12] Python Nếu không có số trước dấu: (hoặc sau dấu :) thì sẽ mặc định là bắt đầu từ đầu hoặc từ cuối. Nếu thiếu cả 2 số thì sẽ là in cả chuỗi đó Thứ tự các phần từ...
Learning Guide Unit 7
- Nhận đường liên kết
- X
- Ứng dụng khác
Strings The for loop The in operator Lists The range function Matrices . Strings 8.1. A string is a sequence 8.2. len 8.3 Traversal with a for loop 8.4 String slices 8.5 Strings are immutable 8.6 Searching 8.7 Looping and counting 8.8 String methods 8.9 The in operator 8.10 String comparison 8.11 Debugging 8.12 Glossary 8.13 Exercises 10. Lists 10.1 A list is a sequence3 10.2 Lists are mutable 10.3 Traversing a list 10.4 List operations 10.5 List slices 10.6 List methods 10.7 Map, filter and reduce 10.8 Deleting elements 10.9 Lists and strings 10.10 Objects and values 10.11 Aliasing 10.12 List argument 10.13 Debugging 10.14Glossary 10.15 Exercises 12. Tuples 12.1 Tuples are immutable 12.2 Tuple assignment 12.3 Tuples as return values 12.4 Variable length argument tuples 12.5 Lists and Tuples 12.6 Dictionaries and tuples 12.7 Comparing tuples 12.8 Sequences of sequences 12.9 Debugging 12.10 Glossary 12.11 Exercises
5.1. Modules and Getting Help- 5.5. Glossary
- Nhận đường liên kết
- X
- Ứng dụng khác
random() function returns a floating point number in the range[0.0 - 1.0] -> mặc định là như thế randrange(a, b) thì sẽ chạy từ a tới b (số nguyên) deterministic: xác định Một quá trình lặp lại và có thể dự đoán A process that is repeatable and predictable. documentation - Tài liệu A place where you can go to get detailed information about aspects of your programming language. Nơi mà bạn có thể tới để có thông tin chi tiết về các khía cạnh ngôn ngữ lập trình của mình module A file containing Python definitions and statements intended for use in other Python programs. The contents of a module are made available to the other program by using the import statement. Một tập tin chứa các định nghĩa và câu lệnh để sử dụng trong chương trình python khác. Nội dung củam ột modul được cung cấp cho chương trình khác bằng cách sử dụng câu lệnh import. pseudo-random number A number that is not genuinely random but is instead created algorithmically. Mã giả - số ngẫu nhiên ra...
4.10. Glossary
- Nhận đường liên kết
- X
- Ứng dụng khác
attribute Some state or value that belongs to a particular object. For example, tess has a color. canvas - Bề mặt nơi sẽ vẽ ra A surface within a window where drawing takes place. control flow See flow of execution in the next chapter. for loop A statement in Python for convenient repetition of statements in the body of the loop. instance An object that belongs to a class. tess and alex are different instances of the class Turtle invoke viện dẫn An object has methods. We use the verb invoke to mean activate the method . Invoking a method is done by putting parentheses after the method name, with some possible arguments. So wn.exitonclick() is an invocation of the exitonclick method. - đại loại như là cần có sự tác động khác để dẫn tới hành độn khác. iteration A basic building block for algorithms (programs). It allows steps to be repeated. Sometimes called looping . loop body Any...
4.9. Summary of Turtle Methods
- Nhận đường liên kết
- X
- Ứng dụng khác
Method Parameters Description Turtle None Creates and returns a new turtle object forward distance Moves the turtle forward backward distance Moves the turle backward right angle Turns the turtle clockwise left angle Turns the turtle counter clockwise up None Picks up the turtles tail down None Puts down the turtles tail color color name Changes the color of the turtle’s tail fillcolor color name Changes the color of the turtle will use to fill a polygon heading None Returns the current heading position None Returns the current position goto x,y Move the turtle to position x,y begin_fill None Remember the starting point for a filled polygon end_fill None Close the polygon and fill with the current fill color dot None Leave a dot at the current position stamp None Leaves an impression of a turtle shape at the current location shape shape name Should be ‘arrow’, ‘classic’, ‘turtle’, ‘circle’ or ‘square’
4.5. Flow of Execution of the for Loop
- Nhận đường liên kết
- X
- Ứng dụng khác
range(4) tương đương với 0, 1, 2, 3 range (1,5) ==> 1, 2, 3, 4 Turtle methods can use negative angles or distances. So tess.forward(-100) will move tess backwards, and tess.left(-30) turns her to the right. Additionally, because there are 360 degrees in a circle, turning 30 to the left will leave you facing in the same direction as turning 330 to the right! (The on-screen animation will differ, though — you will be able to tell if tess is turning clockwise or counter-clockwise!) This suggests that we don’t need both a left and a right turn method — we could be minimalists, and just have one method. There is also a backward method. (If you are very nerdy, you might enjoy saying alex.backward(-100) to move alex forward!) Part of thinking like a scientist is to understand more of the structure and rich relationships in your field. So reviewing a few basic facts about geometry and number lines, like we’ve done here is a...