Feb. 20, 2024, 10:57 p.m. | Paulo GP

DEV Community dev.to




Introduction

In this chapter, we'll explore the use of for and while loops in Python. We'll start by showing how to create a loop using the range function, which allows us to iterate over a sequence of numbers. For example, we can use range to create a loop that prints the numbers 1 to 10:



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



Output:
1
2
3
4
5
6
7
8
9
10





Using Range with Specific Intervals

We can also …

beginners example explore function guide introduction iterate loop numbers programming python

Software Engineer for AI Training Data (School Specific)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Python)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Tier 2)

@ G2i Inc | Remote

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US