Feeds:
Posts
Comments

Archive for February, 2011

Input is the entering data into the program and variable is temporary place for storing the data. There are 2 data that you can enter, string and number.

See the sample variables below:

a=12345

b=”I’m python

a is number and b is string.

 

See the sample input below:

my_string=raw_input(“What is your name?”)

my_number=input(“Enter your number?”)

raw_input() function will give a string and input() function will give a number.

 

Now, let’s try directly in the idle.

Open Idle editor.

Select File > New Window.

 

In the new window, type the codes below:
__________________________________________

print “Welcome to Python”

print “—————–“

print “”

s=raw_input(“Please, enter your name? “)

print “Hi..”,s,” Nice to meet you”

n=input(“Please, enter your favorite number? “)

print “Your favorite number + 3 =”,n+3
__________________________________________

In the ‘New window’, select ‘Run > Run Module‘.

If there is no error, you will see the result in the Idle main screen.

Read Full Post »

What is Python?

Python is a dynamic programming language that combine great power with very clear syntax. Guido Van Rossum began to work with python in late 1980 at National Research Institute for Mathematics and Computer science in Netherland (CWI). Before I read the history, I though it came from name of snake. But I was wrong. Guido named it when he saw ‘Monthy Python’s Flying Circus‘ comedy TV show in BBC.


Write your own first syntax

Well, no need to explain more details about python, you can find it in the Internet. Just let’s start.
Open Linux Terminal (Applications > Accessories > Terminal) then type: python.
You will get ‘>>>>’ prompt. It’s mean that python is ready to get any commands.

(more…)

Read Full Post »