Mini-Tutorial Python

>>> range(1,10)
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range(-32, -20)
[-32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21]
>>> range(5,21)
[5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
>>> range(21,5)
[]
      
----------------------------------------
onetoten = range(1,11)
for count in onetoten:
        print count
----------------------------------------
for count in range(1,11):
        print count
----------------------------------------
      
1
2
3
4
5
6
7
8
9
10
      
demolist = ['life',42, 'the universe', 6,'and',7,'everything']
for item in demolist:
    print "The Current item is:",
    print item
      
The Current item is: life
The Current item is: 42
The Current item is: the universe
The Current item is: 6
The Current item is: and
The Current item is: 7
The Current item is: everything
      
AnteriorInicioSiguiente