|12/12||Topics: Interview questions
Lecture slides: CSI32_Lecture27_InterviewQuestions.pdf
|prepare for the Final Exam|
|12/07||topics: Interview questions
Lecture slides: CSI32_Lecture26_InterviewQuestions.pdf
Programs: anagramCheck.py, checkUniqueness.py, reArrange.py
|prepare for the Final Exam|
|12/05||topics: Section 16.5 Peer-to-peer connection.
Lecture slides: CSI32-Lecture25.pdf
Programs: p2pAlt.py, p2pAlt_g.py (in progress)
|no HW assignment|
|11/30||topics: Section 16.4 Chat room
Lecture slides: CSI32-Lecture24.pdf
Programs: threadsExample.py, chatserver.py, chatclient.py
|HW14 (due date: Wednesday, December 7th):
As you can see our chat server is very clumsy.
One needs to keep pressing Enter to see if anything new popped-up, sees his/her messages sent/(receives them as well, including notification that the person joined the chat)... maybe you noticed something else.
Try to fix it (start with the second one)!
Section Section 16.3
Lecture slides: CSI32-Lecture23.pdf
data.txt, webserver.py, webclientFile.py
|no HW assignment|
|11/24 - 11/27|
|11/23||topics: Chapter 16 Network programming
Sections 16.1and 16.2
Lecture slides: CSI32-Lecture22.pdf
Programs: socketExample.py, gettime.py, webclient.py, easywebclient.py
|no hw assignment|
|11/21||topics: Chapter 12 More Python Containers:
12.1 Two Familiar Containers: list and tuple
12.3 Containers of containers
12.4 Set and Frozenset
Lecture slides: CSI32-lecture21.pdf
Programs, data : dictionary-examples.py, arrays-example.py, data.txt, load-data.py
|HW13 (due date: Wednesday, November 30th):
implement addition of two matrices
- each input matrix is stored in a file
- the new matrix should be displayed and save in a output file
|11/16||topics: Chapter 8 Input, Output and Files
Lecture slides: CSI32-lecture20.pdf
|HW12 (due date: Wednesday, November 23rd):
p. 293-294 / 8.6 and 8.11
Addition for 8.6: if while searching through the file you find that a year is negative, raise a Value Exception, saying that a birth year cannot be negative.
For both of the programs: catch IOError and deal with them as it was dealt in project 18.
|11/14||In-class project with event-handling:
We will write a program that can do a bunch of things:
1) Convert from Celsius degrees to degrees of Fahrenheit
2) Convert from Fahrenheit to Celsius degrees
3) Find the distance between two points (mouse clicks)
4) Convert from us pounds to kilograms
5) Convert from kilograms to us pounds
The original source code: mix.py
1) when working with "small windows" re-use the exitButtonHandler
2) Button is not working in those small windows. Instead use Rectangle and Text. Attach handler to both rectangle and text.
|no hw assignment|
|11/09||topics: Section 15.4 and some discussion on mouse drag (two issues there)
Lecture slides: CSI32-lecture18.pdf
Programs : ShapeDragging.py, ShapesWork.py,
|11/07||topics: Section 15.3
Please note that Chaper 15 has a lot of corrections/updates that were done after the book was printed, therefore here is an updated pdf of this chapter: ch15.pdf.
Lecture slides: CSI32-lecture17.pdf
|suggested homework assignment (not for grade):
write a program that:
- draws three distinct objects (say a circle, a triangle and a rectangle), then
- user can drag the figure around the screen
- user can scale the figure (re-size)
- user can change the fill color of the figure
- user can remove the figure from the paper
The last three items can be done with keyboard, for example:
if 'm' key is pressed the figure is re-sized with a ratio of 2 (magnified),
if 'z' button is pressed, the figure is re-sized with a ratio of 0.5 (zoomed out),
if 'c' button is pressed, the fill color of the figure is changed,
if 'd' button is pressed, the figure is removed from the paper
All the events should be commented by a text message.
Here is a sketch of the program: Section15_3HomeworkSketch.py
|11/02||topics: Chapter 15: Event-driven Programming
Sections 15.1 and 15.2
Lecture slides: CSI32-lecture16.pdf
Programs: oneClick.py, clicks.py, clicks_mod.py, example1.py, example2.py, example3.py, example3_mod.py, example4.py
cs1graphics library: grab from http://www.cs1graphics.org/
(due date: Wednesday, November 9th):
Write a program that draws any two objects filled with some color. When a user clicks on any of them - they change color. Under each object you should create a counter - that will be counting the number of clicks (clicks only) on this object.
Number of clicks: 10 Number of clicks: 6
Don't forget our Exit Button (for user to terminate the program).
Don't forget to close the graphics window at the end of the program.
Recursion (sections 11.3, 11.4)
Lecture slides: CSI32-lecture15.pdf,
Programs, data : factorial_rec.py, binary_search.py
|HW10 (due date: Monday, November 7th):
Recall Fibonacci numbers/sequence recursive definition :
F(0)=1 (base case)
F(1)=1 (base case)
F(n)=F(n-1) + F(n-2) for all integers n>1
Write a program, that for a given non-negative integer n, displays nth Fibonacci number, and
prints all the Fibonacci function calls.
Here is a snapshot of the program's output on Fibonacci(4):
Please, input any non-negative integer:4
Calculating Fibonacci of 4
Calculating Fibonacci of 2
Calculating Fibonacci of 3
Calculating Fibonacci of 1
Calculating Fibonacci of 2
The 4 th Fibonacci number is 3
The sketch of a program is given in lecture slides.
Similar to example with Factorial Function (recursive definition) (slides 6 – 13 ) draw a figure of Fibonacci Function call on n = 5
Suggestion: it is probably worth doing the picture as a tree. See the figure in the lecture slides.
|10/26||topics: Recursion (sections 11.1, 4.3)
Lecture slides: CSI32-lecture14.pdf,
Programs : bullseye.py, bullseye2.py, pyramid.py, pyramid_as_class.py, pyramid_as_class2.py
Suggested homework (not for grade):
page 391 / 11.5 or 11.6
Lecture slides: CSI32-lecture13.pdf,
Programs: star_class.py, star_class2.py
Description of Polygon class can be found here
|review your midterm exams!|
Sections 9.1 Augmentation,
9.2 Specialization, and
9.3 When Should Inheritance (Not) Be Used
Lecture slides: CSI32-lecture12.pdf,
Programs: fraction_class_lib.py, mixed_numbers_class.py, mixed_numbers_class_2.py, mixed_numbers_class_alternative.py
(due date: Monday, October 24th):
1) pages 327 - 328 / 9.1, 9.2, 9.3
2) Write the functions/methods/behaviors for subtraction, multiplication and negation of mixed numbers
take care of the negative mixed numbers (update all the behaviors to accommodate negative mixed numbers)
Hint: sign can be stored as a separate attribute (- 2 3/5),
or "attached" to the whole part (-2 3/5)
|10/06||Thursday, but runs on Monday's schedule
topic: Hangman game
source files to be used: Hangman_run_me.py, inputTxt.py, outputTxt.py, scoring.py, dictionary.py, dict.txt
|no HW assignment was given, but if you are curious,
there is a nice example of design and implementation of the MasterMind game in the textbook (Sections 7.1 - 7.3).
Links to videos about the game: https://www.youtube.com/watch?v=r_12laxWv6E
Online game: http://www.web-games-online.com/mastermind/
Set Class (page 234, exercise 6.15)
BinaryNumber Class (page 235, exercise 6.18)
Lecture slides: CSI32-lecture10.pdf
Programs: set-class.py, binaryNumbers-class.py
(due date: Wednesday, October 12th) - change of due date to Monday, 10/17:
Improve our Binary Numbers class:
- fix __lt__ method or update the constructor,
- add __gt__ method,
- add XOR, AND, OR methods (work on strings of the same length)
Here is some info on bitstrings operations XOR, AND, and OR: bitOperations.pdf
|10/03||no classes today
The detailed syllabus for our class is updated and posted. csi32syllabus-Fall2016Detailed.pdf
The Midterm Sample is updated to Midterm Sample questions. It has a list of questions that can be on the midterm exam, but not all of them will be on the Midterm Exam. midterm_CSI32sample.pdf
|09/28||topic: Section 6.4 Fraction Class
Lecture slides: CSI32-lecture09.pdf,
Programs: class-level-attrExample.py, fraction_class1.py, fraction_class2.py, fraction_class3.py
Please note that there will be no classes on Monday, 10/03 and Tuesday, 10/04
In addition, Thursday, 10/06 will run on Monday's schedule.
(due date: Wednesday, October 5th):
1) Update/modify our fraction class to accommodate negative numbers
2) problem 6.1 on page 231 (has answer at the end of the book)
3) problem 6.4 on page 232
Rotating, Scaling, Flipping, and Cloning (Sections 3.3, 3.4) + drawing graphs of functions
Here you can find the description of classes from cs1graphics library: http://euler.slu.edu/~goldwasser/class/slu/csci150/2006_Fall/doc/cs1graphics.html
Here is Chapter 3 from the book (Separately): ch03.pdf
Lecture slides: CSI32-lecture08.pdf,
Programs: rotation-example1.py, rotation-example2.py, scaling-example.py, flipping-example.py, cloning-example.py, cloning-fun.py, rec_coord_system.py
suggested homework (due date: as soon as you can) not for grade, do not submit:
1) Use the figure you did in previous assignment. Perform the following actions:
- shrink it,
- stretch it,
- flip it,
- rotate it about some arbitrary point in the graphics window, which is not on/in the figure,
- make few copies of it, with different colors and dimensions (shrink, stretch, rotate...).
2) Draw a rectangular coordinate system, and using line segments (path) draw a "curve" of y=x2-10 for x = [-5, 5]
Lecture slides: CSI32-lecture07.pdf,
Graphics library: cs1graphics.py
Programs: example1.py, example1_2.py, example2.py, example3.py, example4.py, tree.png
(due date: as soon as you can) not for grade, do not submit:
Write a program that draws a composite object (i.e. not a parallelogram, triangle, or circle) in the middle of the graphics window, then moves this object to the right side of the graphics window, and then to the left side of the graphics window. Movement should be smooth (without jumps). During the movement object should change it's color at least 12 times.
Afterwards in order to notify the user that the program won't do anything else display a text, saying something like "That's it. No more tricks!".
Don't forget to close the graphics window. Use sleep() method !
Section 5.2 Functions
Section 5.4 Case Study: computing the square root
Sections 5.5 Error Checking and Exceptions
Lecture slides: CSI32-lecture06.pdf,
Programs: exceptionCatch.py, exceptionRaise.py, exceptionRaise2.py sumOfSquares.py, quadraticEquation.py, quadraticEquation-complexRoots.py
(due date: Wednesday, September 28th):
More examples of work with strings: Exercise 2.37 DNA mutation (pages 86-87)
Section 4.5 More about lists: List Comprehension
Section 2.6 Calling Functions
Section 2.7 Python Modules
Section 2.8 Expressions
Lecture slides: CSI32-lecture05.pdf,
Programs: mutatedDNA.py, exercise_4-38.py, exercise_4-38-mod1.py, exercise_4-38-mod2.py
(due date: Wednesday, September 21st):
Chapter 7 - Good Software Practices
Section 2.2 list Class (review)
Section 2.3 str and tupple
Section 2.4 Numeric types: int, float and long (review)
Section 2.5 Type Conversions
Lecture slides: CSI32-lecture04.pdf
Programs: gcd-alg1.py, gcd-alg2.py, gcd-alg3.py, list-example1.py, list-example1.py, list-example1.py
(due date: Monday, September 19th):
1. page 84 / 2.24
2. Write a program that takes a string of words separated by a space from the user;
converts is to a list of strings, using whitespace as the separator;
then if an element of the list is a string of digits, the program converts it to a whole number (positive integers), and replaces the corresponding element of the list with this number.
The conversion should be done for all such elements (that are whole numbers, written as a strings).
Example of input-output:
Input (from the user): Hello buy mind 5 abc 12 0 1243 thank
Your program must be well commented!
Overwise 0.5 points will be taken off
3. Write a program that takes a list of "words" as an input (from a user, from the keyboard; "words" are separated by commas), echoes it to the display/screen and then allows the user to remove all occurrences of an item provided by user from the list.
Comments: the user will provide something of this kind as an input: mother,hello,1823,buy,thank you,you are welcome.
Your program will take it as a string. In order to generate a list from it you can use method split.
Example of a program's run: - added on 10/05
Input a list of words, separated by commas, no spaces please: mother,hello,1823,buy,hello,thank,you,welcome,hello
Here is the list of words you entered: ["mother","hello", "1823","buy","hello","thank","you","welcome","hello"]
Type in the word to be removed: hello
1.4 Object-Oriented Paradigm, and
few UML diagrams: activity, sequence and class diagrams.
Orientation Meeting for CS major students: tomorrow, Thursday, 09/08
12:00 pm - 1:50pm at Begrisch Hall 226.
More details: click here
(due date: Wednesday, September 14th):
page 29 / 1.19
page 30/ 1.20, 1.22, 1.27, 1.31
For 1.20: The book has an answer for 1.20, but try to do it on your own first, and then, if needed, refer to the solution. Please, note that we did not create Schedule class and hence didn't use it in our scenarios, so you shouldn't use it either.
- this comment was only in the lecture slides originally, and today (10/02) I am putting it here as well.
4.1 For Loops,
4.2 Case Study: DNA to RNA Transcription, and
5.1 While loops
Lecture slides: CSI32-lecture02.pdf
programs: DNA-RNA-transc.py, DNA-RNA-transc2.py, for_list.py, for-loop.py, while-loop.py
Please note that on Labor Day (Monday, 09/05) the college is closed. There will be no classes!
(due date: Monday, September 12th):
Exercise 1: Give a flowchart portraying the algorithm you wrote for problem 1.5 or 1.8,
page 155 / exercise 4.29
page 196 / exercise 5.6
|08/29|| Welcome to CSI 32!
1.1 Data and Types,
1.2 Operations, Functions, and Algorithms, and
4.4 Conditional Statements
Lecture slides: CSI32-lecture01.pdf
HW1 (due date: Wednesday, September 7th):
1) Exercise 1: Implement both algorithms for finding gcd (it can be done as one program)
Input: from keyboard
Python operators you can use: a%b returns the remainder of the division ( in math: a mod b )
Modifications (not mandatory):
1. Input from a file
2. Ability to run the algorithms on as many input pairs as the user wants
2) Other exercises:
p. 28 № 1.4,
p. 29 № 1.5 or 1.8 (your choice), and
p.154 № 4.22