Lecture 11/17/2026

This commit is contained in:
Edward Bigos 2026-11-17 12:30:27 -05:00
commit bf3265103a
44 changed files with 1195 additions and 3 deletions

View file

@ -0,0 +1,23 @@
#!/usr/bin/python3
# Program: if02
# Lists of numbers. These could be integers or floats.
intList = [7, 2, 16, 18, 12, 21]
# Print the list and the length
print(intList," length = ",len(intList))
print(f"Print each value in the list")
counter = 0
for item in intList:
print(f"intList[{counter}] = {item:2d}")
counter += 1
cutoff = 13
print(f"Print each value in the list >= {cutoff}")
counter = 0
for item in intList:
if(item >= cutoff):
print(f"intList[{counter}] = {item:2d}")
counter += 1