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

@ -19,3 +19,5 @@ for Item in addressDictionary.keys():
print(f"{Item:10s} {addressDictionary[Item]}")
pprint(addressDictionary)

View file

@ -3,6 +3,7 @@
# List element manipulation.
scores = [75, 95, 90, 87, 99, 100, 97, 100]
#scores = [100,100,100,100,100,100, 100, 100]
numberOfScores = len(scores)

View file

@ -10,8 +10,8 @@ print (dogNames," length = ",len(dogNames),"Type =",type(dogNames))
print("\n")
for item in dogNames:
# print(f"{item:14s} {type(item)}")
print(f"{item} {type(item)}")
print(f"{item:14s} {type(item)}")
# print(f"{item} {type(item)}")
print("\nDone!")

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)))

View file

@ -0,0 +1,32 @@
program01 = '''
Program: if01
This program demonstrates the conditional tests used in Python.
'''
print(program01)
a = 4
b = 7
c = 7
print(f"a = {a}\nb = {b}\nc = {c}\n")
print(f"a == b {a==b}")
print(f"a != b {a!=b}")
print(f"a < b {a<b}")
print(f"a <= b {a<=b}")
print(f"a > b {a>b}")
print(f"a >= b {a>=b}")
print("\n")
print(f"c == b {c==b}")
print(f"c != b {c!=b}")
print(f"c < b {c<b}")
print(f"c <= b {c<=b}")
print(f"c > b {c>b}")
print(f"c >= b {c>=b}")

View file

@ -0,0 +1,27 @@
# if statement example
if 22 > 7:
print("22 is greater than 7")
print("A better method to define the code ...")
# Use variables in the if statement and print
data1 = 22
if data1 > 7:
print(f"{data1} is greater than 7")
# Or this form
print("And another method to define the code ...")
data1 = 22
data2 = 7
if data1 > data2:
print(f"{data1} is greater than {data2}")
print("Program ended")

View file

@ -0,0 +1,16 @@
# if..else statement example
x = 7
print(f"{x} is equal to 7?")
if x == 7:
print("Yes")
else:
print("No")
# if..else statement example
x = 5
print(f"{x} is equal to 7?")
if x == 7:
print("Yes")
else:
print("No")

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

View file

@ -0,0 +1,25 @@
#!/usr/bin/python3
# Program: if03
# 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}")
else:
print(f"========> intList[{counter}] = {item:2d} is less than {cutoff}")
counter += 1

View file

@ -0,0 +1,7 @@
# consider the following line from the autoloan program:
principal = float(input("Enter a value for the principal: "))
print(f"You entered the value {principal}")

View file

@ -0,0 +1,16 @@
# consider the following line from the autoloan program:
principal = float(input("Enter a value for the principal: "))
if(principal < 5000.) or (principal >120000.00):
print(f"The loan value {principal} is outside the allowed limits.")
exit(-1)
rate = float(input("Enter a value for the interest rate (7 for 7%): "))
numberOfYears = float(input("Enter the number of years for the loan: "))
print(f"You entered the principal value {principal}")
print(f"You entered the rate value {rate}%")
print(f"You entered the loan term value {numberOfYears} years")

View file

@ -0,0 +1,8 @@
data1 = float(input("Enter the dividend "))
data2 = float(input("Enter the divisor "))
quotient = data1/data2
print(f"{data1}/{data2} = {quotient}")

View file

@ -0,0 +1,13 @@
import sys
data1 = float(input("Enter the dividend "))
data2 = float(input("Enter the divisor "))
try:
quotient = data1/data2
print(f"{data1}/{data2} = {quotient}")
except:
print(f"Invalid value. Division by zero is not allowed.")
sys.exit(-1)

View file

@ -0,0 +1,20 @@
import sys
try:
data1 = float(input("Enter the dividend "))
except:
print(f"Invalid value for the dividend ")
sys.exit(-2)
try:
data2 = float(input("Enter the divisor "))
except:
print(f"Invalid value for the divisor ")
sys.exit(-3)
try:
quotient = data1/data2
print(f"{data1}/{data2} = {quotient}")
except:
print(f"Invalid value. Division by zero is not allowed.")
sys.exit(-1)

View file

@ -0,0 +1,19 @@
import sys
def getFloatValue(message):
try:
data1 = float(input(message))
except:
print(f"Invalid value for a floating point number. ")
sys.exit(-2)
return data1
data1 = getFloatValue("Enter value for the dividend ")
data2 = getFloatValue("Enter value for the divisor ")
try:
quotient = data1/data2
print(f"{data1}/{data2} = {quotient}")
except:
print(f"Invalid value. Division by zero is not allowed.")
sys.exit(-1)

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View file

@ -0,0 +1,15 @@
<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" />
</list>
</option>
</inspection_tool>
</profile>
</component>

View file

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

14
lecture20261117/while/.idea/misc.xml generated Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5.1 (/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5)" project-jdk-type="Python SDK" />
</project>

8
lecture20261117/while/.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/while.iml" filepath="$PROJECT_DIR$/.idea/while.iml" />
</modules>
</component>
</project>

11
lecture20261117/while/.idea/while.iml generated Normal file
View file

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

605
lecture20261117/while/.idea/workspace.xml generated Normal file
View file

@ -0,0 +1,605 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c585b7fe-c79c-46e0-b118-2ecfc239055e" name="Default" comment="" />
<ignored path="while.iws" />
<ignored path=".idea/workspace.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="while" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
<file leaf-file-name="while01.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/while01.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="while02.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/while02.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="81">
<caret line="3" column="9" selection-start-line="0" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="while03.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/while03.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="54">
<caret line="2" column="11" selection-start-line="0" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="while04.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/while04.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="81">
<caret line="3" column="80" selection-start-line="0" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="while05.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/while05.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="432">
<caret line="16" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="names1.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/names1.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="837">
<caret line="31" column="35" selection-start-line="0" selection-start-column="0" selection-end-line="32" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="names2.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/names2.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="783">
<caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="rectangle2.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/rectangle2.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="162">
<caret line="10" column="11" selection-start-line="10" selection-start-column="11" selection-end-line="10" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/while01.py" />
<option value="$PROJECT_DIR$/while02.py" />
<option value="$PROJECT_DIR$/while03.py" />
<option value="$PROJECT_DIR$/while04.py" />
<option value="$PROJECT_DIR$/while05.py" />
<option value="$PROJECT_DIR$/names1.py" />
<option value="$PROJECT_DIR$/names2.py" />
<option value="$PROJECT_DIR$/rectangle2.py" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="y" value="23" />
<option name="width" value="1280" />
<option name="height" value="805" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="while" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="while" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="while" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
<property name="settings.editor.splitter.proportion" value="0.2" />
<property name="last_opened_file_path" value="$USER_HOME$" />
</component>
<component name="RunManager" selected="Python.rectangle2">
<configuration default="false" name="while04" type="PythonConfigurationType" factoryName="Python" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/while04.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<method />
</configuration>
<configuration default="false" name="while05" type="PythonConfigurationType" factoryName="Python" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/while05.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<method />
</configuration>
<configuration default="false" name="names1" type="PythonConfigurationType" factoryName="Python" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/names1.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<method />
</configuration>
<configuration default="false" name="names2" type="PythonConfigurationType" factoryName="Python" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/names2.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<method />
</configuration>
<configuration default="false" name="rectangle2" type="PythonConfigurationType" factoryName="Python" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/rectangle2.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<method />
</configuration>
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<method />
</configuration>
<configuration default="true" type="Tox" factoryName="Tox">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<method />
</configuration>
<configuration default="true" type="ccruntests" factoryName="Run Study Tests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="studyTest" value="" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Attests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Doctests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Nosetests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="PARAMS" value="" />
<option name="USE_PARAM" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Unittests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="PUREUNITTEST" value="true" />
<option name="PARAMS" value="" />
<option name="USE_PARAM" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="py.test">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="while" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="testToRun" value="" />
<option name="keywords" value="" />
<option name="params" value="" />
<option name="USE_PARAM" value="false" />
<option name="USE_KEYWORD" value="false" />
<method />
</configuration>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="Python.while04" />
<item index="1" class="java.lang.String" itemvalue="Python.while05" />
<item index="2" class="java.lang.String" itemvalue="Python.names1" />
<item index="3" class="java.lang.String" itemvalue="Python.names2" />
<item index="4" class="java.lang.String" itemvalue="Python.rectangle2" />
</list>
<recent_temporary>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="Python.rectangle2" />
<item index="1" class="java.lang.String" itemvalue="Python.names2" />
<item index="2" class="java.lang.String" itemvalue="Python.names1" />
<item index="3" class="java.lang.String" itemvalue="Python.while05" />
<item index="4" class="java.lang.String" itemvalue="Python.while04" />
</list>
</recent_temporary>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1280" height="805" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12440191" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.47808218" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/while01.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while02.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="81">
<caret line="3" column="9" selection-start-line="0" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while03.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="54">
<caret line="2" column="11" selection-start-line="0" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while04.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="81">
<caret line="3" column="80" selection-start-line="0" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while05.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="432">
<caret line="16" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/names1.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="837">
<caret line="31" column="35" selection-start-line="0" selection-start-column="0" selection-end-line="32" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/names2.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="783">
<caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/rectangle2.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while01.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while02.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="81">
<caret line="3" column="9" selection-start-line="0" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while03.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="54">
<caret line="2" column="11" selection-start-line="0" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while04.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="81">
<caret line="3" column="80" selection-start-line="0" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/while05.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="432">
<caret line="16" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/names1.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="837">
<caret line="31" column="35" selection-start-line="0" selection-start-column="0" selection-end-line="32" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/names2.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="783">
<caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/rectangle2.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="162">
<caret line="10" column="11" selection-start-line="10" selection-start-column="11" selection-end-line="10" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

View file

@ -0,0 +1,32 @@
print("Process fNames")
fNames = [ "Harry", "Moe", "Katrina", "Colorado", "Shenanigans", "Tracey"]
lNames = [ "Bigos", "Howard", "Smith", "Jones", "Davis", "Carter"]
counter = 0
print("\nThe length of the list is {}\n".format(len(fNames)))
while(counter < len(fNames) ):
print("Counter = ",counter)
print("fNames[{}] = {}".format(counter,fNames[counter]))
print("lNames[{}] = {}\n".format(counter,lNames[counter]))
counter = counter + 1
print("Process list - sorted - but doesn't work right")
fNames.sort()
lNames.sort()
counter = 0 ;
print("\nThe length of the list is {}\n".format(len(fNames)))
while(counter < len(fNames) ):
print("Counter = ",counter)
print("fNames[{}] = {}".format(counter,fNames[counter]))
print("lNames[{}] = {}\n".format(counter,lNames[counter]))
counter = counter + 1
print("Problem: How do we sort both lists and keep the first and last names together.")

View file

@ -0,0 +1,29 @@
print("Process fNames")
fNames = [ "Harry Bigos", "Moe Howard", "Katrina Smith", "Colorado Jones", "Shenanigans Davis", "Tracey Carter"]
counter = 0
print("\nThe length of the list is {}\n".format(len(fNames)))
while(counter < len(fNames) ):
print("Counter = ",counter)
print("fNames[{}] = {}".format(counter,fNames[counter]))
counter = counter + 1
print("Process list - sorted - but doesn't work right")
fNames.sort()
counter = 0 ;
print("\nThe length of the list is {}\n".format(len(fNames)))
while(counter < len(fNames) ):
print("Counter = ",counter)
print("fNames[{}] = {}".format(counter,fNames[counter]))
counter = counter + 1
print("Problem: How do we sort both lists and keep the first and last names together.")
print("One solution: Redefine the data.")

View file

@ -0,0 +1,30 @@
print("Calculate the area of a rectangle")
counter = 3
length = float(input("Enter the length of one side: "))
while(length <= 0):
print("ERROR: The length must be greater than zero")
print("You entered {}".format(length))
counter = counter - 1
if(counter <= 0):
print("Too many tries. Program exiting.")
exit(-1)
length = float(input("Enter the length of one side: "))
runFlag = True
counter = 3
while(runFlag):
width = float(input("Enter the width of the other side: "))
if(width <= 0):
print("ERROR: The width must be greater than zero")
print("You entered {}".format(width))
counter = counter - 1
if(counter <= 0):
print("Too many tries. Program exiting.")
exit(-1)
else:
runFlag = False
area = length * width
print("The area is {}".format(area))

View file

@ -0,0 +1,15 @@
print("Down counter")
counter = 5 ;
while(counter > 0 ):
print("Counter = ",counter)
counter = counter - 1
counter = 0 ;
print("Up counter")
while(counter < 5 ):
print("Counter = ",counter)
counter = counter + 1

View file

@ -0,0 +1,9 @@
print("Down counter")
counter = 5 ;
index = 0
while(counter > 0 ):
print("Counter = ",counter, " Index = ", index)
index = index + 1
counter = counter - 1

View file

@ -0,0 +1,11 @@
print("Process list")
counter = 5 ;
index = 0
names = [ "Harry", "Larry", "Moe", "Katrina", "Colorado", "Shenanigans"]
while(counter > 0 ):
print("Counter = ",counter, " Index = ", index)
print("names[{}] = {}\n".format(index,names[index]))
index = index + 1
counter = counter - 1

View file

@ -0,0 +1,14 @@
print("Process list")
names = [ "Harry", "Larry", "Moe", "Katrina", "Colorado", "Shenanigans", "Tracey"]
counter = len(names) ;
index = 0
print("\nThe length of the list is {}\n".format(counter))
while(counter > 0 ):
print("Counter = ",counter, " Index = ", index)
print("names[{}] = {}\n".format(index,names[index]))
index = index + 1
counter = counter - 1

View file

@ -0,0 +1,26 @@
print("Process list - minimal code")
names = [ "Harry", "Moe", "Katrina", "Colorado", "Shenanigans", "Tracey"]
counter = 0
print("\nThe length of the list is {}\n".format(len(names)))
while(counter < len(names) ):
print("Counter = ",counter)
print("names[{}] = {}\n".format(counter,names[counter]))
counter = counter + 1
print("Process list - sorted")
names.sort()
counter = 0 ;
print("\nThe length of the list is {}\n".format(len(names)))
while(counter < len(names) ):
print("Counter = ",counter)
print("names[{}] = {}\n".format(counter,names[counter]))
counter = counter + 1