- They are easy- if you need simple program, they are great for fast development , easy to write, debug, and for others to read and understand your code. You can write a program to calculate expense in just about 5 mins using the build in types.
- They are useful - you can use them to build more complex object. They are like lego, you can stack them and form different tools.
- Efficient - if you want performance, look no further, they are perfected by developer, and will only get better as more release follow. It is less likely you will write a more efficient routines than them, although maybe for highly specialized input.
- Always here - every python comes with them, you don't have to download anything extra, and they are standardize cross everyone. Everyone has the same copies when they download the Python.
Name | Example | Sample Code | Reference |
Number | 12345, 1234.5 | ||
String | ‘Hello Python’ | ||
List | [1, 2, 3] [‘a’, ‘b’, ‘c’] | csci133list.py | |
Dictionary | {‘username’:’password’} | csci133dictionary.py | |
Boolean | True, False | csci133boolean.py |
Here is an index of some of the basic build in types offered by python, please note there are a lot more other kinds that I didn't have a chance to cover! Although it is my goal, to write about all the build in data types :) . Python is dynamically typed (instead of declaring the type and compile the code), and strongly typed (means you can not perform other type function on another type). It is something to keep in mind when you are learning other languages.
No comments:
Post a Comment