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

3
lecture20261117/for01/.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

10
lecture20261117/for01/.idea/for01.iml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -0,0 +1,19 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="W29" />
<option value="E501" />
<option value="W29" />
<option value="E501" />
<option value="W29" />
<option value="E501" />
<option value="W29" />
<option value="E501" />
</list>
</option>
</inspection_tool>
</profile>
</component>

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
lecture20261117/for01/.idea/misc.xml generated Normal file
View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (for01)" project-jdk-type="Python SDK" />
</project>

8
lecture20261117/for01/.idea/modules.xml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/for01.iml" filepath="$PROJECT_DIR$/.idea/for01.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,15 @@
# Program to print squares of all numbers present in a list
# https://beginnersbook.com/2018/01/python-for-loop/
# List of integer numbers
numbers = [1, 2, 4, 6, 11, 20]
# variable to store the square of each num temporary
sq = 0
# iterating over the given list
for val in numbers:
# calculating square of each number
sq = val * val
# displaying the squares
print(sq)

View file

@ -0,0 +1,12 @@
# Program to print the sum of first 5 natural numbers
# https://beginnersbook.com/2018/01/python-for-loop/
# variable to store the sum
sum = 0
# iterating over natural numbers using range()
for val in range(1, 6):
# calculating sum
sum = sum + val
# displaying sum of first 5 natural numbers
print(sum)

View file

@ -0,0 +1,8 @@
#https://beginnersbook.com/2018/01/python-for-loop/
for val in range(5):
print(val)
else:
print("The loop has completed execution")

View file

@ -0,0 +1,7 @@
# https://beginnersbook.com/2018/01/python-for-loop/
for num1 in range(0,3):
for num2 in range(0, 3):
print(num1, ",", num2)

View file

@ -0,0 +1,9 @@
# https://www.programiz.com/python-programming/for-loop
digits = [0, 1, 5]
for i in digits:
print(i)
else:
print("No items left.")

View file

@ -0,0 +1,10 @@
# https://www.programiz.com/python-programming/for-loop
digits = [70, 91, 85]
scoreSum = 0
for i in digits:
print(i)
scoreSum += i
else:
print("The average is ",scoreSum/len(digits))

View file

@ -0,0 +1,14 @@
#https://www.programiz.com/python-programming/for-loop
# program to display student's marks from record
student_name = 'Soyuj'
student_name = 'James'
marks = {'James': 90, 'Jules': 55, 'Arthur': 77}
for student in marks:
if student == student_name:
print(marks[student])
break
else:
print('No entry with that name found.')

View file

@ -0,0 +1,16 @@
# This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/

View file

@ -0,0 +1,10 @@
# https://www.programiz.com/python-programming/for-loop
print(range(10))
print(list(range(10)))
print(list(range(2, 8)))
print(list(range(2, 20, 3)))