Announcement 3: Final Semester Grades

The following figure is the histogram of the grand total grade for this course.

Lecture 11: Python advanced topics - decorators and classes

This lecture discusses some further important topics in Python: Decorators and Classes. Pyton Decorators In simple words, Python decorators are functions that can modify (e.g., add to) the functionalities of other functions. As will be described below, decorators are particularly...

Homework 10: Problems - Python advanced, Monte Carlo methods

This homework further explores Monte Carlo methods in Python. 1.  Monte Carlo approximation of the number $\pi$. Suppose we did not know the value of $\pi$ and we wanted to estimate its value using Monte Carlo methods. One practical approach...

Quiz 7: Problems - Python - I/O, error handling, and tesing frameworks

This quiz aims at testing your basic knowledge of Python’s I/O. 1.  Consider this comma-separated data file. Write a simple Python code outputter.py that takes two command line arguments like the following, python outputter.py outputter.in outputter.out and then writes the...

Lecture 10: Python advanced topics - IO, Monte Carlo, wrappers and interoperability

This lecture discusses some further important topics in Python IO, the use of random numbers and Monte Carlo simulations, as well as methods of integrating Python codes with codes from other programming languages, in particular, the use of Python as...

Homework 9: Problems - Python advanced IO, Monte Carlo

This homework aims at giving you some experience with Python’s tools for interacting with the World Wide Web and writing Monte Carlo simulations. Update: As I discussed in class, in order to avoid creating potential traffic on Professor Butler’s webpage,...

Lecture 9: Python - array computing and plotting

This lecture focuses on array computing and code vectorization, as well as methods of plotting data in Python. Vectorization and array computing With regards to capabilities of Python for scientific calculations, there are conflicting opinions. On the scientific side of...

Homework 8: Problems - Python array computing and plotting

This homework aims at giving you some experience with Python’s array computing and plotting features. 1.  The while-loop implementation of a for-loop. Consider the following mathematical function resembling a Hat function, \[f(x) = \begin{cases} 0 ~, & \text{if}~~ x<0 \\...

Quiz 6: Problems - Python modules, loops, and IO

This quiz aims at testing your basic knowledge of Python’s modules, loops and simple I/O. Don’t forget to push your answers to your remote repository by the end of quiz time. Push your quiz-6 readme.md file to quiz/6/ folder in...

Lecture 8: Python - I/O, error handling, and testing frameworks

This lecture further explains topics on Input/Output processes and error handling in Python, as well as methods of testing the accuracy and robustness of your code. I/o (continued) So far in this course, we have indirectly discussed several methods of...

Homework 7: Problems - Python I/O, error handling, and unit testing

This homework aims at giving you some experience with Python I/O, error handling in your code, and testing you code for accuracy and robustness. 1.  Write a simple program named sum.py, that takes in an arbitrary-size list of input floats...

Lecture 7: Python - modules, loops, and I/O

This lecture explains modules, loops, with a brief introduction to Input/Output processes in Python. Ideally, modules should have been part of the previous lecture (with Python functions). The split was however necessary to reduce the size of lecture 6 to...

Homework 6: Problems - Python modules, loops, and I/O

This homework aims at giving you some experience with Python for-loops and while-loops as well as reading user input from the Bash command line. 1.  The while-loop implementation of a for-loop. Consider the following example code, which converts a list...

Quiz 5: Problems - Python variables and assignment statements

This quiz aims at testing your basic knowledge of Python’s print function, and the how to string manipulation in Python. Don’t forget to push your answers to your remote repository by the end of quiz time. Push your quiz-5 readme.md...

Lecture 6: Python - branching and functions

This lecture explains branching statements, how to define functions in Python, and all other important details of functions in Python. Branching in Python Consider the last problem in homework 4, where we defined a dictionary of people names and their...

Homework 5: Problems - Python branching and functions

This homework aims at giving you some experience with variables in Python and their syntax, also some experience with using Lists and Dictionaries in Python. Write your Python scripts with the corresponding *.py file names, and add a readme.md file...

Quiz 4: Problems - Python values, variables, types

This quiz aims at testing your basic knowledge of Python’s print function, and the how to string manipulation in Python. Don’t forget to push your answers to your remote repository by the end of quiz time. Push your quiz-4 readme.md...

Lecture 5: Python - variables and assignment statements

This lecture further explains different types of variables in Python, branching statements, how to define functions, and what Python modules are. Programming glossary The following table summarizes some of the important keywords in this lecture for you. Table 1. Some...

Homework 4: Problems - Python variables and assignment statements

This homework aims at giving you some experience with variables in Python and their syntax, also some experience with using Lists and Dictionaries in Python. Write your Python scripts with the corresponding *.py file names, and add a readme.md file...

Lecture 4: Python - values, variables, and types

This lecture aims at guiding you to understand the how to of programming, difference between programming languages and the natural languages, the type of programming errors and the meaning code debugging how to perform simple arithmetic operations on the Python...