摘要:
In this chapter I present classes to represent playing cards, decks of cards, and poker hands.If you don't play poker, you can read about it at http:/... 阅读全文
摘要:
17.1 Object-oriented featuresPython is an object-oriented programming language, which means that it provides features that support object-oriented pro... 阅读全文
摘要:
16.1 TimeAs another example of a user-defined type, we’ll define a class called Time that records the time of day. The class definition looks like thi... 阅读全文
摘要:
15.1 User-defined typesWe have used many of Python’s built-in types; now we are going to define a new type. As an example, we will create a type calle... 阅读全文
摘要:
12.1 Tuples are immutable(元组是不可变的)A tuple is a sequence of values. The values can be any type, and they are indexed by integers, so in that respect tu... 阅读全文
摘要:
DictionariesA dictionary is like a list, but more general. In a list, the indices have to be integers; in a dictionary they can be (almost) any type.Y... 阅读全文
摘要:
10.1 A list is a sequenceLike a string, a list is a sequence of values. In a string, the values are characters; in a list, they can be any type. The v... 阅读全文
摘要:
3.1 Function callsIn the context of programming, a function is a named sequence of statements that performsa computation. When you define a function, ... 阅读全文
摘要:
8.1 A string is a sequenceA string is a sequence of characters. You can access the characters one at a time with thebracket operator:>>> fruit = 'bana... 阅读全文
摘要:
问题:两个有序数组a和b,合并成一个有序数组c。 1 // 合并两个有序数组a和b到c 2 void Merge_Array(int a[], int n, int b[], int m, int c[]) 3 { 4 int i, j, k; 5 i = j = k = 0; 6 ... 阅读全文