A challenge to write and get the o/p in a single line

September 21, 2010 at 3:16 am (Python)

<pedro3005>we can say that each letter has a number equivalent. a = 1, b = 2, etc. Write a program that takes in a name and outputs the sum of all numbers of the equivalent letters, in one line, not counting the “import” lines

<pedro3005> It must ignore spaces and be case-insensitive

<pedro3005> Mohan_chml, like “pedro” must be 58

Read the rest of this entry »

Advertisements

Permalink Leave a Comment

Indentation

August 9, 2010 at 11:26 pm (Python)

Whitespace is important in Python. Actually, whitespace at the beginning of the line is important.

This is called indentation. Leading whitespace (spaces and tabs) at the beginning of the logical line is used to determine the indentation level of the logical line, which in turn is used to determine the grouping of statements.
Read the rest of this entry »

Permalink Leave a Comment

Operators and their usage

August 1, 2010 at 9:57 pm (Python)

Operator Name Explanation Examples
+ Plus Adds the two objects 3 + 5 gives 8. ‘a’+’b’ gives ‘ab’.
Minus Either gives a negative number or gives the subtraction of one number from the other -5.2 gives a negative number. 50 – 24 gives 26.
* Multiply Gives the multiplication of the two numbers or returns the string repeated that many times. 2 * 3 gives 6. ‘la’ * 3 gives ‘lalala’.
** Power Returns x to the power of y 3 ** 4 gives 81 (i.e. 3
of 3* 3 * 3 * 3)
/ Divide Divide x by y 4/3 gives 1 (division of integers gives an integer).4.0/3 or 4/3.0 gives 1.3333333333333333 Read the rest of this entry »

Permalink Leave a Comment

How variable work in Pyton

July 31, 2010 at 9:40 am (Python)

Now lets enter into the programming.

The first thing that one has to know is how to define variables, so that those variables can be used in the programs in future.

In python, there is no need to declare a variable, Instead we define one whenever needed. python knows what operations suit for the values in that variable.

Lets make it known by writing some examples

Read the rest of this entry »

Permalink 1 Comment

Make your python program run like an Application In Linux

July 29, 2010 at 2:01 pm (Python)

Try this:
Type: $ firefox

This code opens up the firefox installed in our machine.

In a similar fashion, you can make your .py program to run like an application.

Read the rest of this entry »

Permalink Leave a Comment

Traditional Program :D

July 27, 2010 at 1:37 am (Python)

Ok. Lets start with our traditional program, the Hello world program.

The main purpose of IDLE and python terminal is to dynamically check whether the code we entered is correct or not. Read the rest of this entry »

Permalink Leave a Comment

Install and code Python In your Machine

July 24, 2010 at 4:01 pm (Python)

For Windows users, you can download and install Python from here.

And for Linux Users. Python Is default in Operating Systems like Ubuntu.

Ways to Code Python In linux

There are many ways to code Python in linux. They are

  • Using Terminal

Read the rest of this entry »

Permalink 1 Comment

First Pen About python

July 24, 2010 at 2:47 pm (Python)

Whoa!!! Here we go.

I mean Lets start (Don’t go away 😛 ).

The stuff I am going to pen in this blog is about Python. To begin with any process, We must look at the History. So My first Post is about the History of Python.

Read the rest of this entry »

Permalink Leave a Comment