From 11da8437fa3868894eb4934aef96ec7898ac5665 Mon Sep 17 00:00:00 2001 From: Junior Date: Wed, 5 Jun 2024 21:17:02 -0400 Subject: [PATCH] Add for loop to loops demo --- Python/014_loops.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Python/014_loops.py b/Python/014_loops.py index a07dcd7..1e48fe7 100644 --- a/Python/014_loops.py +++ b/Python/014_loops.py @@ -11,4 +11,20 @@ while number <= 10: print(f"Number: {number}") number = number + 1 +# The range(start, end) function returns +# numbers starting with "start" and ending +# one number before "end". +# range(0, 10) will return numbers from 0 to 9 + +# This is a "for" loop. For loops are used to +# iterate over lists or other collections of data. +# To iterate means to walk through a set of data +# one element at a time. A for loop lets you walk +# through a collection of data and do something +# with each element of that collection. +print("Numbers:", end='') +for num in range(0, 10): + print(f" {num}", end='') +print() + print() \ No newline at end of file