Introduction to Programming using Python
This website contains all lectures, labs and recordings used in the course Introduction to Programming using Python.
These documents are not to be sold, published, or distributed without the author’s consent.
Instructor: Dr. Ming Ming Tan
Email: mtan@augusta.edu
Fall 2023
Week 1 Aug 16
Lecture content: Introduction to computational thinking, see lec0.pptx, recording: lecture_week0
Week 2 Aug 21, 23
Lecture:
- The basics element of Python, see lec1.pptx
- Demonstration in class: first_program_demo.ipynb
Lab:
- Colab notebook: simple_programs.ipynb
What we have discussed:
- Display to screen using print().
- Compute Mathematics expression.
- Variable.
- Type.
Week 3 Aug 28, 30
Lecture:
- The basics element of Python, see lec1.pptx
- Demonstration in class: experiments_demo.ipynb , list_intro_demo.ipynb
- Recordings: lecture_week3a, lecture_week3b, lecture_week3c
Lab:
- Colab notebook: ticket.ipynb
- Presentation: mini_presentation_lab2
What we have discussed:
- The use of input function to get user’s input.
- Type conversion.
- Help function and the user of
dir(). - Import library.
- Intro to list.
- Index of a list.
- Intro to list built-in functions.
Week 4 Sep 6
Lecture content: Lecture:
- The basics element of Python, see lec1.pptx
- Demonstration in class: string_intro_demo.ipynb
Lab:
- Lab Presentation: mini_presentation_lab3
- Lab Colab Notebook: username.ipynb
What we have discussed:
- Intro to str
- Intro to str built-in methods.
- Informal discussion on functions vs methods.
Week 5 Sep 11, 13
Lecture:
- Boolean expression, see lec2.pptx
- Demonstration in class: boolean_demo.ipynb
- Recordings: lecture_week5a, lecture_week5b
Lab:
- Lab Presentation: mini_presentation_lab4
- Lab Colab Notebook: user_input.ipynb
What we have discussed:
- Boolean expressions.
Week 6 Sep 18, 20
Lecture:
- Conditional statements, see lec3.pptx
- Demonstration in class: if_demo.ipynb
- Recordings: lecture_week6a, lecture_week6b
Lab:
- Lab Presentation: mini_presentation_lab5
- Lab Colab Notebook: user_input_if.ipynb
What we have discussed:
- if, if-else, if-elif-else statements.
Week 7 Sep 25, 27
Lecture:
- Iteration statements, see lec4.pptx
- Demonstration in class: for_demo.ipynb
- Recordings: week7a, week7b (part of the week7b content is resumed in mini_presentation_lab6)
Lab:
- Lab Presentation: mini_presentation_lab6
- Lab Colab Notebook: iteration_for.ipynb
What we have discussed:
- for loop
- break
Week 8 Oct 2, 4
Lecture:
- Iteration statements, see lec4.pptx
- Demonstration in class: for_accummulator_demo.ipynb
- Recordings: lecture_week8a, lecture_week8b
Lab:
- Lab Presentation: mini_presentation_lab7
- Lab Colab Notebook: iteration_for_accummulator.ipynb
What we have discussed:
- for loop to accumulate numbers or to count
Week 10 Oct 16, 19
Lecture:
- Iteration statements, see lec4.pptx
- Demonstration in class: while_demo, for_vs_while_demo
- Recordings: lecture_week10a, lecture_week10b
Lab:
- Lab Presentation: mini_presentation_lab8
- Lab Colab Notebook: iteration_while
What we have discussed:
- while loop
- for vs while loop
Week 11 Oct 23, 25
Lecture:
- Numerical computations, see lec5.pptx
- Demonstration in class: floating_point_demo
- Recordings: lecture_week11a, lecture_week11b
Lab:
- Lab Presentation: mini_presentation_lab9
- Lab Colab Notebook: library_system
Corrections to lab 9 (library_system.ipynb):
There were some mistakes made during the mini_presentation_lab9:
-
For Fine system 4: When computing
max_days_late, which defined as the maximum number of days late for which the total rewards will be less than or equal to 20 should bemath.floor((max_fine-7*small_fine)/large_fine+7). -
For Reward system 3: Using
Decimalcan be slow, compute the rewards by converting the corresponding floating point number to its equivalent integer. We can create our own unit system where 1 unit is 0.1 point. When display to the user, convert it back to original point system. In other words, when display the total reward, divide the result by 10. For example, if 3 books are borrowed, then usingreward_pointas 1 will result in reward of 3 unit (where all computations are now as typeint), which when divided by 10, will give 0.3 points, as desired. Remark: Of course, you can also use unit system where 10 unit is equivalent to 0.1 point, and convert it back to original point system by dividing by 100. However, I will be inclined to use a smaller scale that is 1 unit is 0.1 point, rather than 10 unit is 0.1 point.
What we have discussed:
- Floating point errors.
- Loss of significant digit errors.
Week 12 Oct 30, Nov 1
Lecture:
- List, see lec6.pptx
- Demonstration in class: list_demo
- Recordings: lecture_week12a, lecture_week12b
Lab:
- Lab Presentation: mini_presentation_lab10
- Lab Colab Notebook: grade_system
What we have discussed:
- Function and methods on list.
Week 13 Nov 6, 8
Lecture:
- String, see lec6.pptx
- Demonstration in class: string_demo
- Recordings: lecture_week13a, lecture_week13b
Lab:
- Lab Presentation: mini_presentation_lab11
- Lab Colab Notebook: password_system
What we have discussed:
- Function and methods on str.
- Remarks on other data structures.
Week 14, 15 Nov 13, 15
Lecture:
- Exhaustive search, see lec7.pptx
- Demonstration in class: exhaustive_demo
- Recordings: lecture_week14a, lecture_week14b
- Binary search, see lec8.pptx
- Demonstration in class: binary_search_demo
- Recording: lecture_week15
Lab:
- Lab Presentation: mini_presentation_lab12
- Lab Colab Notebook: exhaustive_search_lab
What we have discussed:
- Exhaustive search
- Binary search
Corrections to lab 12 (exhaustive_search_lab.ipynb):
The following mistake was made during the mini_presentation_lab12
In Sample Code 2b, the implementation of version 2 should be
# implement version 2
current_max = L[0]
for i in range(1, len(L)): # iterate indices of L starting from index 1
element = L[i]
if element > current_max:
current_max = element
print(current_max)
line 3 should run iteration from 1 to len(L)-1 inclusive.
current_max is set to the first element of the list (index 0).
In the first iteration, we should compare the second element of the list (index 1) with current_max.
Week 16 Nov 27, 29
Lecture:
- Binary search application
- Demonstration in class: binary_search_application
- Recordings: lecture_week16a, lecture_week16b
What we have discussed:
- Application of binary search: On finding integer square roots. On guessing number game.