Python Fundamentals Wesley J. Chun

ADVERTISEMENT


Python Fundamentals Wesley J. Chun cover page
It corresponds to Chapters 5-7 in Core Python Programming and covers almost all of Python’s standard types. Standard Types The primary types we want you to focus on are integers (int …..

Standard Types Lesson 4 is one of the longest lessons in this LiveLessons video course, so we recommend you break it up and view different segments at a time rather than watching it all in one sitting. It corresponds to Chapters 5-7 in Core Python Programming and covers almost all of Python’s standard types. Standard Types The primary types we want you to focus on are integers ( int ), floating-point numbers ( float ), strings ( str ), lists ( list ), and dictionaries ( dict ). These are the primary data types that you will be using in your applications. One word of caution about the differences between Python versions 2.x and 3.x is that the default string types are ASCII in 2.x but Unicode in 3.x. Python 2.x also features Unicode strings but under a different name; likewise, Python 3.x also features ASCII strings, so watch out for the double name changes! The standard types are broken down into three main categories: numbers, sequences, and hashing types. Numbers are fairly straightforward, sequences are similar to arrays and ordered starting at index 0, and hashing types are those in which the primary access consists of a hashed value, i.e., dictionary keys or set values. Numbers Python has several numeric types. The primary three are integers, floating-point numbers, and complex numbers. We look at int s and float s but not complex—if you are familiar with what they are, you can just look up how to use them in Core Python Programming or the official documentation. If you are not, then you probably won’t need them, so no harm, no foul. You may not think of Booleans ( bool ) as a numeric type because of their only two possible values of True and False ; however, when used in a numeric context, they take on the values 1 and 0 respectively. (We began this lesson by describing how all Python objects have some Boolean value, and how False is generally represented by some numeric zero or empty container while all other values are True .) Older versions of Python also featured a long integer type ( long ), but those have since been merged into the normal int type that we are familiar with. You may, from time to time, see old code and/or output that shows a trailing L representing a long , e.g., 99999999999999L . There are also several numeric types that aren’t directly supported by the interpreter, requiring you to import specific modules to use them. They include the Decimal type, found in the decimal module, as well as the Fraction type, found in the fractions module….

Download Python Fundamentals Wesley J. Chun.Pdf

Leave a Reply


Map: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67