Lecture 1 — Introduction

People

  • Professors : Uzma Mushtaque, Neha Keshan, Mark Gilder

  • Instructional Support Coordinator: Shianne Hulbert

  • TAs and programming mentors: see course website

Learning Outcomes

  1. Demonstrate proficiency in the purpose and behavior of basic programming constructs.

  2. Design algorithms and programs to solve small-scale computational programs.

  3. Write, test and debug small-scale programs

  4. Demonstrate an understanding of the widespread application of computational thinking to real-world problems.

Textbook

  • Practical Programming: An Introduction to Computer Science Using Python by Campbell, Gries, and Montojo

    • Available in e-book form

  • The official text is the third edition, but if you already have the second edition it should be fine. You need to have at least the second edition. The first edition is obsolete and will not help you in this course.

Website and On-Line Resources

  • Our primary online resource will be Submitty. We will use Submitty to submit and grade homeworks, lecture exercises, exams, and etc. Please visit it and explore.

  • We also have a web site that contains a lot of details on the course, course schedules lab and lecture times, lecture notes, sample code, and most of everything you would ever want to know about CS1. You can reach it from the Course Home link on Submitty or by going directly to:

  • To repeat, course notes will be posted on the website as well:

  • Submitty has an Office Hours Queue that will be used to track and organize office hour usage. You should use passcode Office Hours when adding yourself to the queue.

  • Submitty has a Course Materials section that will be used for posting homework assignments, labs, and other material we need to distribute to you:

  • And it has an extensive public discussion site that you are encouraged to use to ask questions about anything course related. We ask that you stay civil in the forum and that you do not post code. Other, than that please use it and monitor it:

    You will be automatically added to Submitty when you enroll in the course, but depending on the Registrar feed it could take up to 48 hours for you to be added. Please be a little patient, but please let an instructor or TA know if you cannot log into this site more than 48 hours after you receive notice from the Registrar that you are enrolled. The site is updated frequently, but not immediately. Some lag is expected. In an emergency, either of the Instructors can override the feed and add you to the course.

Lectures

Labs

  • Lab sections are held in person. Attendance will be taken during lab periods.

    • You will have one lab a week. This will be on either Tuesday or Wednesday depending on your section. Check your schedule(on SIS) or the course web site if you are confused.

    • You are expected to finish your lab within the lab period. We will post the bulk of the lab in Submitty ahead of time so that you can familiarize yourself with it and get a headstart. We will also allow you to complete the final checkpoint within a week of your lab provided you show up on time to lab and work through until the end. Showing up late or leaving early will require that you finish lab during the period for full credit.

    • We will give half credit for any lab checkpoints submitted after your lab period, but before your next lab. You may turn it in to a TA or mentor during Office Hours or at the start of your next lab period,

    • If you know you will be absent for a lab, please view our lab schedule and see if you can find a replacement time. Then contact the TA for both your scheduled section and the section you wish to attend. Note that this is for exceptional occurences and should only be used on rare ocassions. It also requires prior notice and the consent of both TAs involved.

    • Lab 0 is scheduled for the week of September 9th. Lab 0 is mostly about software installation. We will hold an optional installation session on August 29th (Thursday) during exam block at DCC 308. You may go there for installation help to get started with Lab 0 ahead of time.

Office Hours

With the exception of the Instructor Office Hours which will be held as detailed below:

  • When attending office hours in person, join the queue and put In Person as the Contact Information. Wait to be called by the next available TA or mentor.

Other items from the syllabus

  • Professor Mushtaque’s office hours are:

– Monday 10:00 - 11:30am at Amos Eaton 111

– Thursday 10:00 - 11:30am at Aemos Eaton 111

  • Professor Keshan’s office hours are:

– Monday 12:00 - 1:30pm at Amos Eaton 205

– Thursday 12:00 - 1:30pm at Aemos Eaton 205

  • Professor Gilder’s office hours are:

– Monday 3:30 - 5:00pm at Amos Eaton 123

– Thursday 3:30 - 5:00pm at Amos Eaton 123

  • Shianne’s office hours are:

    – Weekdays 9:00 - 5:30 PM

    hulbes@rpi.edu (preferred)

    – or https://rensselaer.webex.com/meet/hulbes (by arrangement)

  • Other office hours are posted on the web site

  • Requirements and grading: lecture exercises, labs, homeworks, tests; letter grades

  • Appealing grades

  • Class attendance and participation; lecture notes

  • Homework late policy:

    • 3 LATE DAYS FOR THE WHOLE SEMESTER

    • 2 LATE DAYS ON ANY ONE ASSIGNMENT

  • Academic integrity

  • Other exceptions: report to me right now or as soon as you know

  • Notes on schedule:

    • Test dates are October 3rd, October 31 and November 21 all from 6:00 pm - 8:00 pm. You must take the test as scheduled unless you have an excused absence from Student Experience. If you do not have an excused absence for a test, you will get a 0. No exceptions!

    • A Final Exam will be held during finals week. No exceptions! Please plan to take it.

The Magic of Programming

  • Cold, harsh logic, and

  • Seemingly primitive syntax…

  • Leading to soaring creativity!

Types of Problems We Will Study

  • Tools used to help you win at Words with Friends

  • Image processing and manipulation

  • Web searching and crawling

  • Programs that work with data from Twitter and Flicker

  • Numerical examples, including games and physical simulations

  • Perhaps even a simple version of (part of) Pokemon Go.

Jumping In Quickly with Our First Program — Hello World

  • We create a text file called hello.py containing just the two lines of Python code:

    print('Hello, World!')
    print('This is Python')
    
  • This is done by launching the Spyder IDE, which is specific to creating and running Python programs

    • IDE stands for ’Integrated Development Environment’

      • Two windows will appear — the top being the editor and the bottom being the Python interpreter

  • Load the hello.py program

  • Run it using the interpreter

  • We can also type Python code directly into the interpreter.

Something a Bit More Interesting

  • We are going to emphasize computational thinking throughout the semester, so let’s look at a fun little problem and get started.

  • This problem is posed in Think Python and taken from the NPR show Car Talk. If you know the answer, do NOT say it!

    “Find the one word in the English language that contains three consecutive double letters.”

  • We will talk through the steps needed to develop and test a Python program to solve this problem.

  • We do not intend that you will understand the details of the program at this time. Rather, this is just an exercise that illustrates the steps of solving a fun problem computationally.

  • On the other hand, it does introduce some elements that will be seeing repeatedly throughout the semester:

    • Files

    • Functions

    • Loops

    • Logic

    • Counting

    • Output

    • Libraries

  • In about six weeks, you will understand all parts of this program!

Looking Back: What Steps Did We Follow?

  1. Develop an understanding of what the problem is really asking. This usually involves playing around with small examples.

  2. Develop and describe a recipe (an “algorithm”) for solving the problem

    • Most recipes will involve multiple parts — multiple functional steps

  3. Turn this recipe into a program in the formal language of Python, one of many different programming languages.

    • English is too imprecise for specification of programs.

  4. Run this program using the Python interpreter.

Programs, Compilers, Interpreters, Abstractions

  • Python is an interpreted language — run immediately and interactively by the Python interpreter, which is itself another (very complex) program

  • Programs in some other (non-interpreted) languages like C, C++ and Java must be compiled (by a “compiler” — another program) into a new program in machine assembly language and then executed.

  • In both cases, we write programs that require other programs in order to run.

    • And, we don’t just need just the compiler or interpreter — we need the file system, the operating system, and the command-line interpreter, each of them complicated, multi-part programs themselves.

  • We don’t really think about the details of these programs; we just think of what they do for us.

    • This is called an “abstraction”.

    • It allows us to think about a problem we are trying to solve without thinking about all the details of all the other systems we are depending on.

    • Thinking in terms of abstractions is fundamental to computer science.

Why Python?

  • Python has a very simple syntax

    • The roles of indentation and blank lines cause the most confusion.

  • Interpreted languages provide immediate, useful feedback

  • Python has a powerful set of tools — abstractions

  • Python is widely used in science, engineering and industry.

  • Python is good for rapid prototyping

    • Sometimes, after a Python program is written and working, the most time-consuming steps are rewritten in either C or C++ and then integrated with the Python code.

Two Types of Errors in Our Python Programs

  • A syntax error is a mistake in the form of the Python code that will not allow it to run.

  • A semantic error is a mistake in the “meaning” of the program, causing it to produce incorrect output, even if it runs.

  • We will demonstrate both types of errors by deliberately introducing errors in our triple double example program.

Python Versions

  • Python, like all programming languages, is continually under development.

  • We will be using the latest version installed by the conda package.

Lab 0

By the end of Lab 0, you should have:

  1. Visited the Submitty site and browsed the forum and file repositories

  2. Gone to the course page

    and followed the instructions to install the Python environment on your computer.

    • There are installers for “native” versions of the environment for Windows, Mac OS X and Linux machines.

  3. Created a Dropbox account to store back-up copies “in the cloud” of homework and lab solutions and lab for the course.

    • Other cloud-based back-up copies are acceptable.

    • This is required. Do not come to us the day your homework is due and tell us you lost your data! Dropbox gives you a private cloud backup and version control.

    • I love github and gitlab. Do not use them for your coursework. We take academic integrity seriously in this course. If you publish your code online and someone copies it, you are responsible.