Циклы. (Python): различия между версиями
		
		
		
		
		
		Перейти к навигации
		Перейти к поиску
		
				
		
		
	
|  (Новая страница: «== Циклы == * [https://docs.python.org/3/tutorial/controlflow.html#for-statements Цикл for (документация)] <syntaxhighlight lang="python" lin...») | |||
| Строка 1: | Строка 1: | ||
| == Циклы == | == Циклы == | ||
| + | * [https://docs.python.org/3/reference/compound_stmts.html#the-while-statement Цикл while (документация)] | ||
| * [https://docs.python.org/3/tutorial/controlflow.html#for-statements Цикл for (документация)] | * [https://docs.python.org/3/tutorial/controlflow.html#for-statements Цикл for (документация)] | ||
| <syntaxhighlight lang="python" line> | <syntaxhighlight lang="python" line> | ||
Текущая версия на 14:35, 10 июля 2022
Циклы
 1 # от 1 до 10
 2 count = 1
 3 while count < 11:
 4     print(count)
 5     count += 1 
 6 
 7 # от 3 до 5
 8 for x in range(3, 6):
 9     print(x)
10 
11 primes = [2, 3, 5, 7]
12 for prime in primes:
13     print(prime)