Introduction to Computer Programming I

CSI31

Monday,Wednesday, 12:00pm-1:50pm, room ME 224

 
Date Details HW assignment
Week 1
08/29 topics to be covered:
1.1 The Universal Machine
1.2 Program Power
1.3 What is Computer Science?
1.4 Hardware Basics

Lecture slides: lecture1.pdf
lecture video about Hardware (from YouTube): https://youtu.be/ctAVC2JwEwI
program: myFirstProgram.py

HW 1 (due date: Thursday, August 31st) not for grade:
  • Install Python 3.6.2

  • p. 21 True/False (1,2,3,4) - not for grade

  • p. 22 Multiple Choice (1,2,3,4) - not for grade

  • p.23 Discussion (1 (a), 2) - not for grade

Here are the pictures of Chapter 1 Exercises for those who don't have a book yet: page 21, page 22, page 23, page 24, page 25
If you want to speed up your Python programming language aquisition then try one of these resources:
1) codecademy: https://www.codecademy.com/learn/learn-python
2) Coding Bat: http://codingbat.com/python
08/31 topics to be covered:
1.5 Programming Languages
1.6 The Magic of Python
1.7 Inside a Python Program
1.8 Chaos and Computers

Lecture slides: CSI31-lecture02.pdf
programs: chaos.py, chaos_comments.py

in-class assignment: CSI31-lecture02InClassAssignment.pdf
a possible solution for problem 2 from in-class assignment: inClassAssignment2.py
HW 2 (due date: Tuesday, September 5th):
  • pp. 24-25 (Programming exercises)
    № 1, 4, 5 (only 4 and 5 will be graded)

  • pp. 20-21, read section 1.9 Summary.
    Here is the Summary for those who don't have a book yet: page 1, page2.

  • pp. 21-22 True/False (5-10) - not for grade
    pp. 22-23 Multiple Choice (1, 2, 5-10) - not for grade
    p. 23 Discussion (1 (b-f), 5) -not for grade

Here are the pictures of Chapter 1 Exercises for those who don't have a book yet:
page 21, page 22, page 23, page 24, page 25
Answers to T/F, Multiple Choice and Discussion questions from Chapter 1: CSI31Chapter1answers.pdf
URL for homework's status: https://goo.gl/Mf82hU

Week 2:
09/05 topics to be covered:
2.1 Software Development Process
2.3 Elements of Program
2.4 Output Statements
2.5 Asssignment Statements

Lecture slides: CSI31-lecture03.pdf
programs: area.py, area_2.py

in-class assignment: CSI31-lecture03InClassAssignment.pdf
Solutions: CSI31_Lecture03-In-classAssignmentSols.pdf
HW3 (due date: Tuesday, September 12th):
  • read Sections 2.1-2.5

  • p. 51 True/False (1-8) - not for grade,

  • p. 52 Multiple Choice (4-6) - not for grade,

  • Programming exercise: page 55/ 9, 10
09/07 topics to be covered:
2.6 Definite Loops
2.7 Example Program: Future Value

Lecture slides: CSI31-lecture04.pdf
programs: for_loop_list.py, futureValue.py

in-class assignment: CSI31-Lecture04_In-ClassAssignment.pdf
Solutions: CSI31-Lecture04_In-ClassAssignmentSols.pdf
HW4 (due date: Thursday, September 14th):
  • read Sections 2.6-2.8

  • p. 51 True/False (9-10) - not for grade,

  • p. 52 Multiple Choice (8, 10) - not for grade,

  • p. 53 Discussions (4, 7) ,

  • Programming exercise (not from the book): Write a program that reads in twelve numbers using for loop (from the user, from the keyboard) and then outputs:
        - the sum of all the numbers,
        - the sum of squares of all the numbers, and
        - the average of all numbers
Chapter 2 answers to True/False and Multiple Choice questions: CSI31Chapter2answers.pdf

Week 3:
09/12 topics to be covered:
3.1 Numeric Data Types
3.2 Type Conversions and Rpunding
3.3 Using Math Library
3.4 Accumulating Results: Factorials

Lecture slides: CSI31-lecture05.pdf
programs: example.py, factorial.py

in-class assignment: CSI31-lecture5InClassAssignment.pdf, InClassAssignment1_sketch.py, InClassAssignment2_mod_errors.py
Solutions: InClassAssignment1.py, InClassAssignment2_mod.py
HW5 (due date: Tuesday, September 19th):
  • page 76, True/False: 1, 3, 5 - not for grade,

  • page 77, Multiple Choice: 1-9 - not for grade,

  • pages 77-79, Discussion All - not for grade,

  • pages 79-82, Programming exercises: 1, 16
09/14 topics to be covered:
3.4 Limitations of Computer Arithmetic
7.1 Simple Decisions
7.2 Two-Way Decisions

Lecture slides: CSI31-lecture06.pdf
programs: wage.py, wage_mod.py, simpleDecision.py, simpleDecision_mod.py, simpleDecision_mod2.py,

in-class assignment: CSI31-lecture06InClassWork.pdf
answers/solutions: CSI31-lecture06InClassWorkAnswers.pdf
  • HW6 (due date: Tuesday, September 26th):
    • page 76-77, True/False: 6-10 - not for grade,

    • page 77, Multiple Choice: 10 - not for grade,

    • page 236/ Multiple Choice 3, 5 - not for grade,

    • pages 238-241 / Programming exercises 5, 9
  • Chapter 3 answers to True/False and Multiple Choice questions: CSI31Chapter3answers.pdf

    Week 4:
    09/19 follows Thursday schedule!

    topics to be covered:
    7.3 Multi-way Decisions
    7.4 Exception Handling
    7.5 Study in Design

    Lecture slides: CSI31-lecture07.pdf
    programs: quadratic-equation.py, quadratic-equation_mod.py, quadratic-another.py, quadratic-another2.py

    in-class assignment: CSI31_lecture07InClassWork.pdf
    answers/solutions: CSI31_lecture07InClassWorkAnswers.pdf
    HW7 (due date: Thursday, September 28th):
    • Write a program that reads in 14 numbers from the user (from keyboard), and outputs:
      - the sum of all negative numbers,
      - the sum of all positive numbers,
      - the number of zeros,
      - the average of positive numbers,
      - the average of negative numbers,
      - the average of all numbers.
      Use exception handling for the cases when an letter of a string is provided instead of a number. In such a case just terminate the program.
      Don't forget to comment your program!

      Hints: (use for loop; count negative numbers and positive numbers),
      at each iteration take the next inputted number
      if it is negative - add it to the sum of all negative numbers, increment the counter of negative numbers
      if it is positive - add it to the sum of all positive numbers, increment the counter of positive numbers
      if it is zero, increment the counter for the zeros,
      When the loop is over, you'll have a sum of all negative numbers, and the sum of all positive numbers, along with the numbers of negative and positive numbers, and the number of zeros. So you'll know how to find the averages.

      Here is a grading rubric for this exercise:
      - the sum of all negative numbers is found correctly (1 point),
      - the sum of all positive numbers is found correctly (1 point),
      - the number of zeros is found correctly (1 point),
      - the average of positive numbers is found correctly (1 point),
      - the average of negative numbers is found correctly (1 point),
      - the average of all numbers is found correctly (1 point),
      - exception handling is used and is used properly (2 points),
      - comments are present and they are meaningful(1 point),
      - clear input/output messages (1 point)

    • Write three different programs that find the maximum of three numbers. The user will input the numbers from the keyboard. You can choose three from four: each to all, decision tree method, sequential processing and Pythons built-in function max.

    09/20-09/22 no classes  
    Chapter 7 answers to True/False and Multiple Choice questions: CSI31Chapter7answers.pdf

    Week 5:
    09/26 topics:
    4.1 Overview
    4.2 The object of objects
    4.3 Simple graphical programming
    4.4 Using Graphical Objects

    Lecture slides: CSI31-lecture08.pdf
    programs: example1.py, anySizeWindow.py, points.py
    Graphics library: graphics.py
    Reference Manual for graphics library: graphics.pdf
    web-page for graphics library: http://mcsp.wartburg.edu/zelle/python/

    in-class assignment: CSI31-lecture08InClassAssignment.pdf, inClassAssignment1_sketch.py
    answers/solutions: inClassAssignment1.py
    HW8 (due date: Tuesday, October 3rd):
    • page 123, True/False: All - not for grade,

    • pages 123-124, Multiple Choice: All - not for grade,

    • page 125, Discussion: 2, 3 - not for grade,

    • look through the graphics library reference manual

    • Write a program that draws a house (no colors, just outlines), then by a click of a mouse in the graphics window colors the house, and finally by another click of the mouse closes the graphics window. Don't forget to comment your program!

    09/28 topics:
    4.4 Using Graphical Objects (continues)
    4.5 Graphing Future Value
    4.7.1 Mouse Clicks

    Lecture slides: CSI31-lecture09.pdf
    programs: ovals.py, ovals-corrected.py, future-price-text.py, future-price-graphics.py, mouseClicks.py, future-price-graphics_mod.py

    in-class assignment: CSI31-lecture09InClassAssignment.pdf
    answers/solutions: inClassAssignment.py
    HW9 (due date: Thursday, October 5th):
    • read section 4.6 - not for grade,

    • look over the in-class programs - not for grade,

    • pages 126-127 / Programming exercises: 7-9
    Chapter 4 answers to True/False and Multiple Choice questions: CSI31Chapter4answers.pdf

    Midterm exam will take place on Tuesday, October 17th
    Study guide: CSI31_midterm_exam_studyGuide.pdf

    Week 6:
    10/03 topics:
    4.6 Choosing coordinates
    4.7 Interactive Graphics

    Lecture slides: CSI31-lecture10.pdf
    programs: quadrilateral.py, tic-tac-toe_begin.py, conversion.py, slideshow.py
    pictures for slideshow: Celtic-tree-of-life.gif, tree-of-life.gif, TreeOfLife.gif
    or:




    in-class assignment: CSI31-lecture10InClassAssignment.pdf
    answers/solutions: inClassAssignment1.py, inClassAssignment2.py, inClassAssignment3.py
    HW10 (due date: Tuesday, October 10th):
    • programming exercise 1: Write a program that upon user's choice of the speed (LOW, MEDIUM, HIGH - should be done as buttons in the graphics window) shows how a ball is falling from the top part of the graphics window, down to the bottom part of the window. The falling should be smooth. Use buttons for the speed selection.

      Here is the grading rubric to it:
      - clear input and choice instructions (1 point),
      - the fall of the ball is smooth (1 point),
      - the exit button is present and is working (1 point),
      - comments (1 point)
    • You can use these pictures of the balls or find any other online.
                     
    • programming exercise 2: grab your program of distance conversion from kilometers to miles (HW3) and make it in graphics! Use entry fields and button for conversion.
    10/05 topics:
    5.1 The String Data Type
    5.2 Simple String Processing
    5.3 Lists as Sequences

    Lecture slides: CSI31-lecture11.pdf
    programs: string_operations.py, months_string.py, months_lists.py, matrix_intro.py

    in-class assignment: CSI31-lecture11InClassAssignment.pdf
    answers/solutions: inClassAssignment2.py, inClassAssignment3.py
    HW11 (due date: Thursday, October 12th):

    • True/False: page 168 / 1, 2, 4, 5 - not for grade,

    • Multiple Choice: page 169 / 1, 2 - not for grade,

    • Discussion: pages 169-170 / 1-2 - not for grade,

    • Programming exercise: page 171 / 4, 5
    No classes on Monday (Columbus day) - the college will be closed

    Week 7
    10/10 topics:
    5.4 String representation and message encoding
    5.5 String methods
    5.6 Lists have methods, too
    5.7 From encoding to encryption

    Lecture slides: CSI31-lecture12.pdf
    programs: encoding.py, decoder.py, date.py, re_ordering.py, CaesarCipher-encoding.py

    in-class assignment: CSI31-Lecture12_inClassAssignment.pdf, inClassAssignment3_notWorking.py
    answers/solutions: inClassAssignment2.py, inClassAssignment3.py
    HW12 (due date: Thursday, October 19th) - changed to Friday, October 20th:

      Programming exercises: page 172 / 6, 9
    10/12 topics:
    5.8 Input/Output as String Manipulation
    5.9 File processing

    Lecture slides: CSI31-lecture13.pdf
    programs: experiments.py, readAllfromFile.py, readAllfromFile_mod.py, createDataFile.py, processDataFile.py
    Files: data.txt, numbers.txt, names.txt

    in-class assignment: CSI31-lecture13InClassAssignment.pdf, inClassAssignment2_draft.py, myFile

    answers/solutions: inClassAssignment1.py, inClassAssignment2.py
    HW13 (due date: Saturday, October 21st) -extended to Saturday, October 28th:

    • True/False: page 168 / 6-10 - not for grade,

    • Multiple Choice: page 169 / 3-10 - not for grade,

    • Discussion: pages 169-170 / 3-4 - not for grade,

    • Programming exercises: page 172 / 14

    Chapter 5 answers to True/False, Multiple Choice and Discussion questions: CSI31Chapter5answers.pdf

    Week 8:
    10/17
    Ask an Astronaut Event
    The BCC Office of Government Relations and External Affairs and US Congressman Serrano are co-hosting an event titled "ASK AN ASTRONAUT" with NASA astronaut Lee Morin on Tuesday, October 17th, from 10 am until noon at Schwendler Auditorium (Meister Hall).

    Please take this opportunity to learn about the exciting career path and the extraordinary accomplishments of Dr. Morin. He holds several post-graduate degrees, including an M.D. and a Ph.D. and is a retired US Navy Captain. As an astronaut, Dr. Marin logged 259 hours in space, including 14 spacewalk hours. A short biography listing his many accomplishments can be found here: morin.pdf.

    Congressman José Serrano for the 15th district of New York in the Bronx will also speak about his service in government and his work with NASA.

    There will be refreshments served and NASA related materials given out at the event. For more information, please see the following pdf: NASA_Flyer.pdf

    Please take advantage of this unique opportunity to hear from one of the few individuals in the world that has been in space.

     
     
    10/19 Midterm exam
    Study guide: CSI31_midterm_exam_studyGuide.pdf

    Part 1: you can use textbook, your notes, pdf of the book, but no Python Interpreters nor search engines (1 hour long).

    Part 2: you can use textbook, your notes, and computers (50 minutes long).
     
    Week 9:
    10/24 topics: Chapter 6. Defining Functions
    6.1 The Function of Functions
    6.2 Functions, Informally
    6.3 Future Value with a Function
    6.4 Functions and Parameters: The Details
    6.5 Functions That Return Values

    Lecture slides: CSI31-lecture14.pdf
    programs/input files: four_numbers.py, square.py, removeSpaces.py, input.txt, triangle.py

    in-class assignment: CSI31_lecture14InClassAssignment.pdf, InClassAssignment2_draft.py, InClassAssignment3_draft.py

    answers/solutions: InClassAssignment1.py, InClassAssignment2.py, InClassAssignment3.py
    HW14 (due date: Wednesday, November 1st):
    • True/False questions: page 203 /1-7 - not for grade,

    • Multiple choice questions: page 204 / 1-5 - not for grade,

    • Discussion: page 205 / 5 - not for grade,

    • Programming exercises: page 206 / 1, 3
    10/26 topics: Chapter 6. Defining Functions
    6.5 Functions That Return Values (continues)
    6.6 Functions that Modify Parameters
    6.7 Functions and program structure

    Lecture slides: CSI31-lecture15.pdf
    programs: prog1.py, prog2.py, prog3.py, tests.py

    in-class assignment: CSI31_lecture15inClassAssignment.pdf, InClassAssignment2.py, InClassAssignment3.py
    answers/solutions: InClassAssignment2_answer.py,
    InClassAssignment3_Fall2017.py
    HW15 (due date: Friday, November 3rd):
    • True/False questions: page 203 /8-10 - not for grade,

    • Multiple choice questions: page 204 / 6-10 - not for grade,

    • Programming exercises: page 207-208 / 7, 11, 13
    Chapter 6 answers to True/False, Multiple Choice and Discussion questions: CSI31Chapter6answers.pdf

    Week 10:
    10/31 topics: Chapter 8. Loops structures and booleans
    8.1 For loops: a quick review
    8.2 Indefinite loops
    8.3 Common loop patterns: interactive, sentinel

    Lecture slides: CSI31_lecture16.pdf
    programs/input files: example1.py, average_i.py, average_s.py, average_s_mod.py, average_i_exceptions.py, average_s_mod_exceptions.py, average_file.py, average_file_mod.py, input.txt, input2.dat, input3.dat

    in-class assignment: CSI31_lecture16InClassAssignment.pdf
    answers/solutions: CSI31_lecture16InClassAssignmentAnswers.pdf, InClassAssignment3.py
    HW16 (due date: Tuesday, November 7th):
    • True/False questions: page 277 /1- 6- not for grade,

    • Multiple choice questions: pages 277-278 / 1-3 - not for grade,

    • Discussion: pages 278-279 / 1-3 - not for grade,

    • Programming exercises: page 279 / 2, 3
    List of possible final projects: final-projects_Fall2017shortList.pdf
     
    11/2 topics: Chapter 8. Loops structures and booleans
    8.3 (Continues) Common loop patterns: nested loops
    8.4 Computing with booleans
    8.5 Other common structures: post-test, loop and half

    Lecture slides: CSI31_lecture17.pdf
    programs/input files: read_all_numbers.py, temperature.py, temperature_infiniteLoop.py

    in-class assignment: CSI31_lecture17InClassAssignment.pdf
    answers/solutions: CSI31_lecture17InClassAssignmentAnswers.pdf
    HW17 (due date: Thursday, November 9th):
    • True/False questions: page 277 /7-10- not for grade,

    • Multiple choice questions: page 278 / 4-10 - not for grade,

    • Programming exercise: page 280 / 4
    Chapter 8 answers to True/False, Multiple Choice and Discussion questions: CSI31Chapter8answers.pdf

    Week 11:
    11/7 topics: Chapter 9. Simulation and Design
    9.1 Simulating racquetball
    9.2 Pseudo-random numbers
    9.3 Top-down design
    9.4 Bottom-up implementation

    Lecture slides: CSI31_lecture18.pdf
    programs/input files: racquetball.py

    in-class assignment: CSI31_lecture18InClassAssignment.pdf
    answers/solutions: Assignment 3 is to be discussed at our next meeting
    HW18 (due date: Tuesday, November 14th):
    • True/False questions: page 307 /1, 2, 4-7, 10- not for grade,

    • Multiple choice questions: pages 307-308 / 1-5 - not for grade,

    • Programming exercise: page 309 / 1
    11/9 topics: Chapters 9 and 10
    9.5 Other design techniques

    Lecture slides: CSI31_lecture19.pdf
    programs/input files: racquetballGraphics.py, Racquetball 2.gif

    in-class assignment: implement craps game
    HW19 (due date: Thursday, November 16th):
    • True/False questions: page 307 /3, 8, 9- not for grade,

    • Multiple choice questions: pages 307-308 / 6-10 - not for grade,

    • Discussion: pages 308 - 309 / 1, 2 - not for grade ,

    • Programming exercise: finish up the code for page 310 / 7 Craps game
    Chapter 9 answers to True/False, Multiple Choice and Discussion questions: CSI31Chapter9answers.pdf

    Week 12:
    11/14 topics: Chapter 10. Defining Classes
    10.1 Quick review of objects
    10.2 Example program: target
    10.3 Defining new classes

    Lecture slides: CSl31_Lecture20.pdf
    programs/input files: target.py, target_mod.py, dice.py, dice_graphics.py, die1.gif, die2.gif, die3.gif, die4.gif, die5.gif, die6.gif, two-red-dice.gif

    in-class assignment: CSl31_Lecture20InClassAssignment.pdf, inClassWork2.py
    answers/solutions: CSl31_Lecture20InClassAssignmentAnswers.pdf - corrected on 11/17 12:30pm, inClassWork2_answer.py
    work on in-class assignment
    11/16 topics: Chapter 10. Defining Classes
    10.4 Data processing with class
    10.5 Objects and encapsulation
    10.6 Widgets

    Lecture slides: CSl31_Lecture21.pdf
    programs/input files: studentsGPA.py, students.txt, program.py, button.py, die.py, dieView.py, die1.gif, die2.gif, die3.gif, die4.gif, die5.gif, die6.gif, two-red-dice.gif

    in-class assignment: CSl31_Lecture21InClassAssignment.pdf, cardTesting.py
    answers/solutions: will not be posted
    HW20 (due date: Thursday, November 30th):
    • True/False questions: page 356 /all- not for grade,

    • Multiple choice questions: page 357 / all - not for grade,

    • Discussion: page 358 / 3- not for grade,

    • Programming exercise: page 361 / 13
    Chapter 10 answers to True/False, Multiple Choice and Discussion questions: CSI31Chapter9answers.pdf

    Week 13:
    11/21 Tuesday runs on Friday's schedule

    no meeting
    work on your HW assignments and Final Project
    11/23 Thursday - Sunday 11/23 - 11/26 College is closed


     
    work on your HW assignments and Final Project


    click on the image to see larger size


    Week 14:
    11/28 topics: Chapter 11. Data Collections
    More about classes
    11.1 Example problem: simple statistics
    11.2 Applying lists
    11.3 Lists of records

    Lecture slides: CSl31_Lecture22.pdf
    programs/input files: conventionsExample.py, targetClass.py, usingTarget.py, background1.gif, simpleStats.py, input1.txt, input2.txt, student.py, studentOrderingByGPA.py, students.txt

    in-class assignment: CSl31_Lecture22InClassAssignment.pdf
    answers/solutions: CSl31_Lecture22-inClassAssignmentAnswers.pdf
    HW21 (due date: Tuesday, Deccember 5th):
    • Programming exercise: page 413 / 7
    11/30 topics: Chapter 11. Data Collections
    11.4 Designing with lists and classes
    11.7 Non-sequential collections


    Lecture slides: CSl31_Lecture23.pdf
    programs/input files: othello.py, students.txt, studentsRecordsAsDictionary.py

    in-class assignment: CSl31_Lecture23-inClassAssignment.pdf
    answers/solutions: to be posted
    HW22 (due date: Thursday, December 7th) - last HW assignment:
    • True/False questions: page 410 /all- not for grade,

    • Multiple choice questions: page 411 / all - not for grade,

    • Discussion: pages 411-412 / all- not for grade,

    • Programming exercise: will not be posted!
    Final Exam is scheduled for Tuesday, December 19th
    10:00 am to 11:50 am at CPH 320

    Week 15:
    12/05 Review

    Slides: lecture24noAnswers.pdf
    Answers: CSI31_Lecture24withAnswers.pdf
    12/07 Review

    Slides: CSI31_Lecture25noAnswers.pdf
    testing set: testingSet.py

    Answers: CSI31_Lecture25withAnswers.pdf
    set (solution): CSI31_Lecture25_set.py

    Final exam study guide: final_exam_CSI31-studyGuide.pdf


    Weeks 16 & 17:
    12/12 Final Project demonstrations
    12/19 Final Exam

      The Final Grade is composed of:
      HWs (30%)
      Midterm Exam (30%)
      Final Project (20%)
      Final Exam (20%)