Problem Set 0: Introduction & Installation

The questions below are due on Friday September 10, 2021; 09:00:00 PM.
 
You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
Download Files
Background Survey

What is your Grade Level?

What is your (first) major? If freshman, choose "Freshman".

What is your second major? If not double majoring or undecided, do not answer this question.

Approximate Lines of Code written before enrolling in 6.0001

Prior Programming Experience?

Why did you enroll in 6.0001?

Select all of the resources that you are aware of or have used to help learn how to program.

Pset Buddy

Do you want to sign up for Pset buddies? Each week you will get assigned a new person to collaborate with on the pset. You and your buddy will be matched based on timezone/experience/class year, and may collaborate on the pset as much as you wish, without penalty for similar code. You can change your options for each pset, up until 9pm the night before the pset is released. For more information, and to sign up for a buddy, please go to Buddy Sign Ups.

Class Info Assessment

Which of the following count towards your grade?

When are problem sets due?

When are mandatory finger exercises due?

Microquizzes are in the last 20-45 minutes of specific lectures outlined in the calendar. What happens if you cannot make it to a microquiz?

You are working with a friend (not your assigned pset buddy) on the problem set. Your friend tells you to use a specific kind of loop to solve a part. Is this a collaboration violation?

You are stuck debugging the problem set. Your friend (not your assigned pset buddy) already finished but they can't stay to help you anymore, so they email you the code. You look over the part you are stuck but write up your own code. Is this a collaboration violation?

Introduction to Python & Spyder

This problem set will introduce you to the programming environment Spyder from the Anaconda Distribution of Python, and to programming in Python, as well as to our general problem set structure. In this problem set, you will confirm your installation of Python, write a simple Python program, and hand it in. Be sure to read this problem set thoroughly, especially the Collaboration and Hand-in Procedure sections.

Collaboration

You may work with other students. However, each student should write up and hand in his or her assignment separately. Be sure to indicate with whom you have worked in the comments of your submission.

Installing Python & Spyder

Follow the steps in the Getting Started handout for installing the Anaconda distribution of Python and Spyder onto the machine you plan to be using this term. The numpy and matplotlib packages, which will be used primarily in 6.0002, should come with the installation. Familiarize yourself with Python and Spyder using the exercises given in the handout. Once you are ready, proceed to the programming part of this assignment.

This class uses Python version 3.0 or higher.

When you first start using your system, make sure that the version number displayed is 3.0 or higher. Python 3 is not backwards compatible with versions starting with 2.x.

Your First Program: Raising a number to a power and taking a logarithm

The goal of this programming exercise is to make sure your python and numpy installations are correct, to get you more comfortable with using Spyder, and to begin using simple elements of Python. Standard elements of a program include the ability to print out results (using the print operation), the ability to read input from a user at the console (for example using the input function), and the ability to store values in a variable, so that the program can access that value as needed.

Assignment

Write a program that does the following in order:

  1. At the top of your file and type: import numpy
  2. Now write a line that sets a variable named x to 5.
  3. Now write a line that sets a variable named y to 8.
  4. Add variables x and y, and save the result to a variable named z.
  5. Now save the result of this command: numpy.log2(z) to a variable named a.

Use Spyder to create your program, and save your code in a file named 'ps0.py'.

Hints:

  • Remember that if you want to hold onto a value, you need to store it in a variable (i.e., give it a name to which you can refer when you want that value). You may find it convenient to look at the variables and strings section of the Python Wikibook.
Hand-in Procedure
Save Save your code in `ps0.py`. *Do not ignore this step or save your file(s) with different names.*

Time and Collaboration Info

At the start of each file, in a comment, write down the number of hours (roughly) you spent on the problems in that part, and the names of your collaborators. For example:

# Problem Set 0
# Name: Jane Lee
# Collaborators: John Doe
# Time Spent: 3:30

… your code goes here …

Submit After you completed the steps in the file "Getting Started" from the downloaded files and Problem 3 above, upload your file here. You may upload new versions of each file until the 9PM deadline, but anything uploaded after that time will be counted towards your late days, if you have any remaining. If you have no remaining late days, you will receive no credit for a late submission.

When you upload a new file, your old one will be overwritten.

  No file selected