-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForControlFlow.py
More file actions
51 lines (32 loc) · 870 Bytes
/
ForControlFlow.py
File metadata and controls
51 lines (32 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
# encoding: utf-8
# -*- coding: utf-8 -*-
"""
ForControlFlow.py
Created by Marko on 2010-02-27.
Copyright (c) 2010 Bstards. All rights reserved.
"""
otraLista = range(7)
print "Lista de digitos: ", otraLista
otraLista = range(20,0,-1)
print "Lista de digitos: ", otraLista
otraLista = range(2,30,2)
print "Lista de digitos: ", otraLista
listaVacia = [None]*5
print "Lista vacia: ", listaVacia
unaLista = ["MontePokara","Pinotepa","uno"]
for s in unaLista:
print "Elemento: " + s + " de longitud:", len(s)
print "\nModificamos la lista mientras se itera"
contador = 0
strAux = ""
for s in unaLista:
# print unaLista
print "Elemento: " + s + " de longitud:", len(s)
if strAux != s:
contador = 0
contador += 1
if len(s) > 7 and contador < 10:
unaLista.insert(0, s.rjust( contador + len(s) ))
strAux = s
print unaLista