Program Examples we wrote in class

Week of Aug 31

Sept 9 - 11

  • Sept 9 Lab Practice

    Sept 9 Lab Practice Solution

  • Lab Practice problem 1
  • Lab Practice problem 2
  • Lab Practice problem 3
  • Lab Practice problem 4
  • Lab Practice problem 5

    Sept 11 Graded Lab Practice Solution

  • sept 11 solution

    Sept 14 - IF , IF ELSE, IF/ELIF/ELSE

  • IF statement

  • IF ELSE

  • IF/ELIF/ELSE

  • Letter grade

  • Bank deposit

    Sept 14 Lab Practice

  • problems 1 and 2

  • problem 3

  • problem 4

    Sept 16 Lecture Practice

  • Problem 5 from the book solution

    Sept 21 Lecture/Lab Practice

  • apples/apple pies problem

  • account deposit after 1 year with 1% or 2% interest

  • leap year

    Sept 23 Lecture/Lab Practice

  • Sept 18 Mini Quiz Solution Version 1

  • Sept 18 Mini Quiz Solution Version 2

  • Sept 18 Mini Quiz Solution Version 3

  • Problem 5 from Practice (same as Mini Quiz but with Taxes)

    Sept 25 Lecture Practice

  • Sept 25 - insurance points example

    Test 1 Solutions

  • Problem 1

  • Problem 2

  • Problem 3

    Sept 28 - Loop While

  • printing numbers between 1 and n using loop While

  • problem 2 lab practice

  • problem 3 lab practice

    Sept 30 - Loop While

  • Sept 30 Practice Solutions for problems 1 - 4

  • problem 1

  • problem 2

  • problem 3

  • problem 4

  • problem 5

    Oct 2 - Sentinel - Controlled Repetition

  • sum and average of non-zero inputs

  • counts items that cost 10 or more

  • count even digits in 10-digit number

    Oct 5

  • Graded Lab Solution

  • warm no rain days example

  • problem 4 from part 1 practice

    Oct 7

  • factorial

  • power

  • sum of divisors

  • random numbers , sum and average of 10 randoms

  • divisible by 4

  • counting positive among 10 random ints

    Oct 9

  • sentinel - controlled repetition - input non-zero ints and finds sum and average

  • counting negative inputs, finding their sum and average

  • counting digits in the input number - sentinel-controlled repetition

  • sum and average of 5-digits number - this is counter-controlled repetition

    Oct 12- LOOP FOR

  • Mini Quiz Solution Oct 9

  • Loop FOR example 1

  • Loop FOR example 2

  • Loop FOR example 3

  • Average price using loop for P>
  • Average Celsius using loop for

  • Average Fahrenheit

  • printing last digit

    Oct 14- LOOP FOR and Test 2 Prep

  • Disney height

  • Parking violations

  • question 4 from http://cs.widener.edu/~yanako/html/courses/Fall20/csci151/oct5.html lab practice

  • problem 3 from test 2 prep using loop for

  • problem 3 from test 2 prep using loop while

    Oct 16

  • program 4 loop for

  • program 4 loop while

    Oct 19 Functions

  • function main

  • test 2 program 1 solution using main

  • function sum

  • function final_price

  • Program 1 from oct5 practice with functions

    Oct 21 Functions

  • test 2 program 2 solution using functions

  • average of 3 ints using function

  • square of numbers using function

  • average grade

    Oct 23 Functions

  • homework solution discounted price

  • even odd with functions

  • even odd with functions for 10 random ints

  • steps

  • homework session b - average grade with functions

    Oct 28 Functions

  • homework solution weather warm no rain days

  • max among inputs

  • temperature using several functions

  • pass/fail

    Oct 30 Functions

  • problem 9 homework

  • returning two values

  • processing grades in the class

    Nov 2 Functions, Nested Loops

  • mini quiz solution

  • nested loop example

    Nov 4 Functions

  • problem 10 from functions practice

  • test preparation - counting positives, negatives, zeros

  • test preparation - counting calories

    Nov 6 Functions

  • problem 13

  • problem 14

  • problem 15

    Nov 9 Functions

  • Exam 3 Problem 1 solution

  • Exam 3 Problem 2 solution

  • academic major

  • sentinel-controlled repetition

  • Sentinel-Controlled Repetition

  • Sentinel-Controlled Repetition problem 1

    Nov 11 One Dimensional Lists

  • list input using index, sum and average

  • list input using append, sum and average

  • grades using append and loop while

  • randomly generated list, printing square and sqrt

  • problem 2 from sentinel-controlled with lists

    Nov 11 Session B Practice

  • practice 1

  • practice 2

  • practice 3

    Nov 13 One dimensional lists with functions

  • add one - showing function ability to change list elements and preserve the changes

  • passing grades with list and functions

  • problem 1 from practice

  • problem 2 from practice

  • problem 7 from sentinel-controlled

    Nov 16 One dimensional lists with functions

  • index method, random_list different solution

  • final price with lists

    Nov 18 Test 4 Prep

  • graded lab Facebook use without lists

  • graded lab Facebook using lists

    Nov 20 Test 4 Prep

  • test 4 prep part 1 problem 1

  • test 4 prep part 1 problem 2

  • test 4 prep part 2 problem 1

  • test 4 prep part 2 problem 2

  • compare lists

    Nov 30

  • text 4 problem 1 solution

  • text 4 problem 2 solution

  • list of strings

  • compare lists

  • nov 23 solution version 1

    Dec 2

  • Nov 23 solution no functions

  • Nov 23 solution with functions

  • Nov 25 solution no functions

  • Nov 25 solution with functions

  • Problem 6 separating grades

    Dec 4

  • Problem 7 evens and even positions

  • Problem 8 count value