Introduction
In all the programs we wrote till now, we have designed our program around functions i.e. blocks of statements which manipulate data. This is called the procedure-oriented way of programming. There is another way of organizing your program which is to combine data and functionality and wrap it inside something called an object. This is called the object oriented programming paradigm. Most of the time you can use procedural programming, but when writing large programs or have a problem that is better suited to this method, you can use object oriented programming techniques.
Read more. Lanjutkan!
Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
Tuesday, January 10, 2012
Wednesday, December 28, 2011
Python: Data Structures
Introduction
Data structures are basically just that - they are structures which can hold some data together. In other words, they are used to store a collection of related data. There are four built-in data structures in Python - list, tuple, dictionary and set. We will see how to use each of them and how they make life easier for us.
Read more. Lanjutkan!
Data structures are basically just that - they are structures which can hold some data together. In other words, they are used to store a collection of related data. There are four built-in data structures in Python - list, tuple, dictionary and set. We will see how to use each of them and how they make life easier for us.
Read more. Lanjutkan!
Thursday, December 1, 2011
Python: Modules
Introduction
You have seen how you can reuse code in your program by defining functions once. What if you wanted to reuse a number of functions in other programs that you write? As you might have guessed, the answer is modules. There are various methods of writing modules, but the simplest way is to create a file with a .py extension that contains functions and variables. Another method is to write the modules in the native language in which the Python interpreter itself was written. For example, you can write modules in the C programming language (http:/ / docs. python. org/ extending/ ) and when compiled, they can be used from your Python code when using the standard Python interpreter.
Read more. Lanjutkan!
You have seen how you can reuse code in your program by defining functions once. What if you wanted to reuse a number of functions in other programs that you write? As you might have guessed, the answer is modules. There are various methods of writing modules, but the simplest way is to create a file with a .py extension that contains functions and variables. Another method is to write the modules in the native language in which the Python interpreter itself was written. For example, you can write modules in the C programming language (http:/ / docs. python. org/ extending/ ) and when compiled, they can be used from your Python code when using the standard Python interpreter.
Read more. Lanjutkan!
Python: Functions
Introduction
Functions are reusable pieces of programs. They allow you to give a name to a block of statements and you can run that block using that name anywhere in your program and any number of times. This is known as calling the function. We have already used many built-in functions such as the len and range. The function concept is probably the most important building block of any non-trivial software (in any programming language), so we will explore various aspects of functions in this chapter.
Read more. Lanjutkan!
Functions are reusable pieces of programs. They allow you to give a name to a block of statements and you can run that block using that name anywhere in your program and any number of times. This is known as calling the function. We have already used many built-in functions such as the len and range. The function concept is probably the most important building block of any non-trivial software (in any programming language), so we will explore various aspects of functions in this chapter.
Read more. Lanjutkan!
Saturday, November 5, 2011
Python: Control Flow if, while and for
Introduction
In the programs we have seen till now, there has always been a series of statements and Python faithfully executes them in the same order. What if you wanted to change the flow of how it works? For example, you want the program to take some decisions and do different things depending on different situations such as printing 'Good Morning' or 'Good Evening' depending on the time of the day?
Read more. Lanjutkan!
In the programs we have seen till now, there has always been a series of statements and Python faithfully executes them in the same order. What if you wanted to change the flow of how it works? For example, you want the program to take some decisions and do different things depending on different situations such as printing 'Good Morning' or 'Good Evening' depending on the time of the day?
Read more. Lanjutkan!
Python: Basics
Just printing 'Hello World' is not enough, is it? You want to do more than that - you want to take some input, manipulate it and get something out of it. We can achieve this in Python using constants and variables.
Read more. Lanjutkan!
Read more. Lanjutkan!
Python: First Steps
Introduction
We will now see how to run a traditional 'Hello World' program in Python. This will teach
you how to write, save and run Python programs.
Read more. Lanjutkan!
We will now see how to run a traditional 'Hello World' program in Python. This will teach
you how to write, save and run Python programs.
Read more. Lanjutkan!
Python: Installation
If you have Python 2.x installed already, you do not have to remove it to install Python 3.0.
You can have both installed at the same time.
Read more. Lanjutkan!
You can have both installed at the same time.
Read more. Lanjutkan!
Subscribe to:
Posts (Atom)