Feeds:
Posts
Comments

Archive for February 19th, 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 »

Follow

Get every new post delivered to your Inbox.

Join 71 other followers