CS 151 - Introduction to Computer Science

Fall 2019


Note: Do not under any circumstances leave your home directory world and/or group accessible in such a manner that others can view your assignment work.

Skip to the latest assignments

  1. HW 1 - Linux and CS Systems Bootcamp

    Remember to read and consult the Linux and CS Systems Bootcamp for getting around Linux. In this assignment, you practice these skills.

    This first HW assignment also gets you used to using our handin system for turning in assignments.

    1. Login to your cs151 account, and run the following commands to check out HW 1:

      	    cd ~
      	    handin -C HW1
      Note that this will create a directory HW1 inside your home directory, and will copy over empty files that you will then edit with answers to the following.

    2. Use the nano text editor to edit your ~/HW1/hello.txt file. Run the commands

      	    cd ~/HW1
      	    nano hello.txt
      Inside of hello.txt in nano fill out the information about yourself that the file asks for (name, major, intended graduate term, experience with programming if any).

    3. Use the hostname and uptime commands when you are logged in to one of the CS systems to see how many days the system has been up. Use the nano text editor to edit your ~/HW1/uptime.txt file and put the following information - (a) what hostname reported, (b) date and time you ran the commands, (c) how many days or hours the uptime command said the system has been up.

      	    cd ~/HW1
      	    hostname
      	    uptime
      	    nano uptime.txt

      Grading note - if you enter incorrect information you do not get credit for this problem. We are checking that you were indeed logged into the system that you put in your file, and that the uptime you report is correct. You need to put the same system for the hostname that you ran the uptime command on.

    4. Use Linux commands to browse to the directory where Jeff keeps his webpages and files for this course. Use the ls command to see how many files are in the directory and what the size is of the largest and smallest.

      	    cd ~jkinne/public_html/cs151-f2019
      	    ls -lh
      	    cd code
      	    ls -lh
      Edit your ~/HW1/courseDir.txt file and in the file give the following (a) How many files were in the ~jkinne/public_html/cs151-f2019 directory, (b) What is the size of the largest and smallest files in that directory, (c) How many files are in the code directory.
      	    cd ~/HW1
      	    nano courseDir.txt

      Grading note - you do not get credit for this problem if you report incorrect information. Note that for the file sizes, we are asking for the file size (how many bytes or kilobytes are the smallest and larges).

    5. Use Linux commands to copy the file hello.py from Jeff's 151 directory into your HW1 directory

      	    cd ~jkinne/public_html/cs151-f2019
      	    cd code
      	    cp hello.py ~/HW1

    Handing in - to handin your assignment, browse to the directory that contains your HW1 directory and use the handin command to turn in your files.

        cd ~
        handin HW1
    Note that you must do this before the due date; late submissions will not be accepted. Also, each time you run "handin HW1" your previous submission is removed, with the new one replacing it.

    Grading - each of the above is worth 1 point, and they are graded "all or nothing", either you have done it correctly or not. We are glad to check your work early, just ask us before/after class or during office hours.

    Due: 26-08-2019 (11:59pm Terre Haute time) / 5 pts

  2. Quiz 2 - Linux and CS Systems
    • You will need to login to the computer, the quiz will be filling in a text file in your account.
    • You will get 1 point for having your full name filled in. Type
      finger cs151xy
      to see whether this is correct (use your account login instead of cs151xy).
    • Fill in the blank questions - what is the Linux command to BLANK? (uptime, df, whoami, hostname, pwd, clear, finger, man, cd, mkdir, ls, cp rm, rmdir, mv, nano) (example - which command tells you how long the system has been up? correct answer - uptime. incorrect answers - UPTIME, Uptime, up time, up-time)
    • What does BLANK mean in the terminal? (enter, up/down arrows, .., ., *, ~, /, tab) (Example - which key on the keyboard do you press to run the command you just typed? Correct - enter)

    In class Aug 28, 5 HW/quiz points

  3. HW3 - Getting Started Python
    1. Checkout HW3 with handin
            cd
            handin -C HW3
            cd HW3
          
    2. Make all of the python files executable.
              chmod a+x count.py
            
      Alternatively we can make all python files in the current directory executable.
              chmod a+x *.py
            
      The python programs can now either be run by:
              python3 operators.py
              ./operators.py
            

      Running the python file directly (with ./) will only work if you are in the same directory as the file.

    3. Using a text editor like atom or nano, complete the count.py, operators.py, factor.py, squares.py, and scores.py programs. More information on the problems can be found here.
    4. A demo of how the correct solutions should work, and some hints/tips are on a screen capture video here (youtube)

    5. Finally turn in your assignment with handin.
              cd
              handin HW3
            
      Due: Sep 08, (11:59pm Terre Haute time) / 5 pts
  4. Quiz 4 - basic python
    • See quiz4practice and quiz4answers in code/Quiz

    Grading -

    In class Sept 6 / 5 pts

  5. Homework 5 - Loops
    1. Review the requirements for programs here.
    2. Checkout HW5 with handin
            cd
            handin -C HW5
          
    3. At any time you can check your program against the autograder
            cd
            handin -h HW5
          
    4. Finally turn in your program with handin
            cd
            handin HW5
          

    Due: 16-09-2019 11:59pm / 7 HW points

  6. Quiz 6 - play computer

    In class 16-Sep-2019 / 10 Quiz points

  7. HW 7 - project 1a
    • For this assignment you get started on a small project. Most will do either a game, something that would be useful to others, or something that uses a Python package.
    • You must do this with a partner. You each need to have copies of the code (email it, or FileZilla). You split the typing time 50/50. You do NOT just have the stronger programmer do everything (both of you will get lower grades if you do this). You will turn in something that says how the work was split. It is best if you do all of the work together in person.
    • You meet with your instructor to get a starting point to your project. Your instructor creates a starting point for you in the cs151 account that you can checkout with handin -C HW7; the starting point will have some comments on what you need to do next. Your instructor can also leave comments in the file of which students or users the code is for.
    • Game options - tic tac toe, hangman, connect4, chess, checkers, mancala, guess the number, dice games, card games. Other ideas?
    • Useful to others options - (think of young kid) - arithmetic practice / quiz, typing practice / quiz, spelling practice/quiz. Other ideas?
    • Python package options - sage math, turtle graphics, reading csv files (and some interesting data). Other ideas?
    • Not more than two groups doing the same project.

    Grading - for 9am section - 4 points for following Jeff's style guide, 6 points for completing tasks give to you by Jeff correctly. If you don't recall which tasks were given to you, check ~cs202/HW7/FILE_YOU_STARTED_WITH. Note - both partners need to turn in the final code.

    Due: 02-Oct-2019 by 11:59pm / 10 HW points

  8. Quiz 8 - functions, lists, tuples

    In class 07-Oct-2019 / 10 Quiz points

  9. Homework 9
    • Checkout HW9 as normal.
    • Complete the programs in the following order: args.py, argsAdd.py, argsIn.py, range.py, file.py, words.py, numbers.py, people.py.
    • Note that the problems build on each other, so you really need to complete the programs in the order given.
    • Note: for argsAdd.py the file to copy is - ~jkinne/public_html/cs151-f2019/code/recipes/args.py
    • Handin HW9 when you are complete.

    Note - there is a video demo of the correct solutions and a few hints, here on youtube.

    9am section - grading - each is worth 1 point. .75/1 for a program if heading in the right direction, runs, does something. -.25 for formatting problem.

    Due: Oct 21 / 8 points

  10. Quiz 10 - on the computer

    See quiz10practice using the handin system for a practice.

    Count max of quiz 10, 11, 12.

    In class Oct 18 / 10 points

  11. Quiz 11 - on the computer

    Count max of quiz 10, 11, 12.

    9am section - grading similar to for quiz12. three programs are each worth 3 points, copying lorem.txt worth 1. formatting issue -.5. -1 for charcount and loop if heading in right direction but not right. -2 if copied charcount but not modified.

    In class Oct 21 / 10 points

  12. Quiz 12 - on the computer

    Count max of quiz 10, 11, 12.

    numbers.py - should have used a loop.

    9am section grading - each of the programs worth 5 points. if program does not run (has an error) it is worth 0 points. if program was barely started but runs it is worth 1 point. program that gives correct output but is formatted wrong (for head, prints list rather than lines; for numbers, formatting doesn't match reference) is worth 4/5. numbers.py - okay if you computed average with / or // (this time, really should have been /).

    In class Oct 23 / 10 points

  13. HW 13 - compilation of problems from quizes last week

    Checkout with handin, follow instructions in files.

    9am section - similar grading as for quiz 12. -.25 for formatting issue. each program worth 1.25 (and you get 1.25 for free for doing something).

    Due Oct 31 / 10 points

  14. HW 14 - weather

    Look for video demo coming soon - see weather part 1, weather part 2, and HW14 demo

    After making HW14 match what is in the video, add the following features.
    1. 3) Average for day of the year. Change to "3) Day of the year average/records". Have it also print record high, record low, record prcp, record snow.
    2. Add "4) All time records". And print out all time record high, low, prcp, snow, mean.
    3. Add "5) Top 50 records". All time top 50 high, all time top 50 low (with dates).
    4. Something you choose of your own.
    5. Create a file weatherInfo.txt in your HW14 directory and give the following: (a) Top 50 high, (b) Top 50 low, (c) average and record values for Jan 1, Feb 1, Mar 1, ..., Dec 1, (d) Average temperature for years 1950-2018, (e) how many of the top 50 high dates are since 2000, and how many of the top 50 low dates are since 2000, (f) top 10 highest annual average temperatures (with year), top 10 lowest annual average temperatures (with year), (g) how many of the top 10 hottest years are since 2000, how many of the top 10 coldest, (h) any other observations you have.

    Grading for 9am section - 8/10 to have the menu working like in the video, 2 points for what you manage on the rest?

    Due/points - depends on your section, see next

    9am section: up through 1. above is due Nov 4 and worth 10 points. The rest is due Nov 6 and worth another 10 points. Note - go ahead and keep working on your HW14 until you see me. Get as many of the answers in weatherInfo.txt as you can. See main 151 page for times to see me. Points: 8 for working menu with loop, 2 for average/records for day of the year, 2 for all time records, 2 for code top 50 records, 2 for something you choose of your own, 1/2 point for correct answers for each of (a)-(h)

    10am section: ??

    11am section: ??

  15. HW15a
    • Checkout with handin, read README file.
    • Small programs.

    Due/points - depends on your section, see next

    • 9am section - 20 points (1 point per program, 1/2 point per answer in info.txt), due Nov 15 by 11:59pm

  16. HW16
    • Option 1 - continue your previous project 1a (HW 7).
    • Option 2 - something different to start from scratch that you choose.
    • Option 3 - choose from Jeff's suggested projects. (a) typing ID - program to use random keyboard typing as a authentication (i.e., in place of a password). (b) weather GUI - develop a graphical user interface for the weather program. (c) human genome - compile statistics and patterns based on the human genome. (d) CS 151 main program - program that is a menu to all of the programs we have done in class, organized by topic and including options to run the programs and print the source code.
    • Option 4 - choose from Adam's suggested projects - (a) GUI weather data or maybe some other data. (b) - CS 151 main program (c) - Program that uses accesses a database. (d) - Game
    • Groups - you can work alone or with a partner for this assignment.
    • 9am section - project choices (most people said what they are planning to work on).
    • 9am section - schedule to come talk to Jeff about your project - if you didn't get an appointment yet let me know...
    • 9am section - presentation - will do in blackboard for this course, Jeff will give a model to go off of a bit later.
    • 11am section - do all your work in a directory named HW16 under your home directory.

    Due/points - depends on your section, see next

    • 9am section - 24 points. Grading - 8 points good programming style, 8 points for containing required programming elements (loops, ifs, functions, lists, dictionaries, input/output, files), 8 points for how awesome it is (4/8 minimally functional, 6/8 good, 8/8 great).
    • 9am section - due end of exam week. When you finish you can ask for it to be graded and then fix things. When you think you're close ask me for an estimate.
    • 9am section - presentation outline - CANCELLED, no longer required -
      • Be ready with three windows to switch between - running your program, your code, your presentation notes. Your presentation should be 5-10 minutes long.
      • Start recording in Yuja.
      • Say hello, what your project is.
      • Run your project, explain what it does while you run it.
      • Show your code
        • Where the program starts, what is the main loop of the program.
        • If - an if test in your code, explain
        • Function - (same - a function in your code, explain it)
        • List
        • Dictionary
        • Input/print
        • File input/output
      • Does anything not work currently?
      • What would you do next?
  17. Practice quiz questions - data structures and algorithms
    • For both binary search and linear search... What is the best-case running time, and give an example where this happens. What is the worst-case running time, and give an example where this happens.
    • Binary search - given a list of sorted numbers and one to look for, trace through the algorithm keeping track of start, end, and middle at each step.
    • Linear search - write python code to do this algorithm (it's just a for loop with an if test inside of it).
    • Binary search - given pseudocode or python code that has a mistake, correct the mistake.
    • Binary search - give pseudocode for the algorithm.

    9am section quiz on 12/4 will have the first two questions.

Note: course website layout/code/template from Steve Baker. Anything horrible is not his fault.