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. Use decision tree method, sequential processing and Pythons built-in function max.

    09/20-09/22 no classes  
    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 , True/False: All - not for grade,

    • page , Multiple Choice: All - not for grade,

    • pages , Discussion: 2, 3 - not for grade,

    • 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!