Loops in programming means repetition in the real life, generally we use "for" and "while".
An example with "while":
>>> i=0
>>> while i<10:
print 'i: ' , i
i += 1
i: 0
i: 1
i: 2
i: 3
i: 4
i: 5
i: 6
i: 7
i: 8
i: 9
In the example above I limited the outputs to get a result (0 => 9).
Here I am using "for":
>>> [number*2 for number in range(10)]
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
"number*2" means a number multiplied by 2,
"in range(10)" means the outputs are constrained and not more than 10 generations
Here I am using loops & variables with "raw_input":
>>> name=raw_input('Who are you? ')
Who are you? ITTIHACK
>>> print 'Welcome ' ,name
Welcome ITTIHACK
The system will print "Welcome" + the name that you entered.
Does "raw_input" works properly in all cases ? let's see,,
>>> res=raw_input('Enter: ')
Enter: 10+30
>>> print res
10+30
By the same method which is used above, but the results are not formatted correctly and we got 10+30 as it is.
To fix this you can use "input" instead of "raw_input":
>>> res=input('Enter: ')
Enter: 10+30
>>> print res
40
One word can do the same function:
See yaa