Added code for lecture 2026-11-10
This commit is contained in:
parent
5b630435ae
commit
07b9e54bf0
52 changed files with 1248 additions and 1 deletions
15
lecture20261110/lists/range01.py
Normal file
15
lecture20261110/lists/range01.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
# This code is based on: https://www.w3schools.com/python/ref_func_range.asp
|
||||
|
||||
x = range(3, 6)
|
||||
print(f"x = {x}, type = {type(x)}")
|
||||
|
||||
# Another way to think of the for loop is to read it as
|
||||
# "Select the next element from the list or range, put it into the variable
|
||||
# item, the do whatever you like with that one value in item".
|
||||
# The for loop ends when the entire list has been processed.
|
||||
|
||||
for item in x:
|
||||
print(item)
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue