TAILIEUCHUNG - Dive Into Python-Chapter 17. Dynamic functions

Tham khảo tài liệu 'dive into python-chapter 17. dynamic functions', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 17. Dynamic functions . Diving in I want to talk about plural nouns. Also functions that return other functions advanced regular expressions and generators. Generators are new in Python . But first let s talk about how to make plural nouns. If you haven t read Chapter 7 Regular Expressions now would be a good time. This chapter assumes you understand the basics of regular expressions and quickly descends into more advanced uses. English is a schizophrenic language that borrows from a lot of other languages and the rules for making singular nouns into plural nouns are varied and complex. There are rules and then there are exceptions to those rules and then there are exceptions to the exceptions. If you grew up in an English-speaking country or learned English in a formal school setting you re probably familiar with the basic rules 1. If a word ends in S X or Z add ES. Bass becomes basses fax becomes faxes and waltz becomes waltzes . 2. If a word ends in a noisy H add ES if it ends in a silent H just add S. What s a noisy H One that gets combined with other letters to make a sound that you can hear. So coach becomes coaches and rash becomes rashes because you can hear the CH and SH sounds when you say them. But cheetah becomes cheetahs because the H is silent. 3. If a word ends in Y that sounds like I change the Y to IES if the Y is combined with a vowel to sound like something else just add S. So vacancy becomes vacancies but day becomes days . 4. If all else fails just add S and hope for the best. I know there are a lot of exceptions. Man becomes men and woman becomes women but human becomes humans . Mouse becomes mice and louse becomes lice but house becomes houses . Knife becomes knives and wife becomes wives but lowlife becomes lowlifes . And don t even get me started on words that are their own plural like sheep deer and haiku . Other languages are of course completely different. Let s design a module that pluralizes nouns. Start with just .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.