Python - jednoduchý cyklus for: Porovnání verzí

Z GeoWikiCZ
m (zpet)
(jemna korekce kodu)
Řádek 6: Řádek 6:
     print i
     print i
   
   
  for i in "a", "b", "c":
  for i in ("a", "b", "c"):
     print i
     print i,
 
1
2
3
4
5
6
7
8
9
a b c


[ [[Python|Zpět]] ]
[ [[Python|Zpět]] ]


[[Kategorie:Programování]]
[[Kategorie:Programování]]

Verze z 2. 9. 2006, 11:40

Ukázka použití jednoduchých cyklů

#!/usr/bin/python

for i in range(1,10):
   print i

for i in ("a", "b", "c"):
   print i,
1
2
3
4
5
6
7
8
9
a b c 

[ Zpět ]