Home / Problem Sets / Problem Set 0

Problem Set 0: Introduction & Installation

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

If you are a current student, 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

1) Background Survey

What is your Grade Level?
Freshman
Sophomore
Junior
Senior
Graduate Student (Non MBA)
MBA Student

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.100A

Prior Programming Experience?
None
HTML
AP Computer Science
Online coding course (code academy, etc.)
Programming Experience in language other than Python
Programming Experience in Python
Took 6.0001/6.100A before
Took a Python course at MIT during IAP before (e.g. 6.145)
Watched or Participated in Programming course in OCW or edX
College course using programming language other than Python
College course using Python

Why did you enroll in 6.100A?
To Learn how to Program
To Fulfill a Course Requirement
To Get a Good Grade
other

Select all of the resources that you are aware of or have used to help learn how to program.
Google
Online coding courses
Stack Overflow
Friends that know how to program

2) Class Info Assessment

(did you read the course info page?)

Which of the following count towards your grade?
problem sets
mandatory exercises
optional exercises on MITx
exams
lecture attendance and participation
recitation attendance and participation

When are problem sets due?
every Monday
every Wednesday
depends on the pset, check the calendar

When are mandatory finger exercises due?
generally available with the pset, and due with the pset
generally available with a lecture, and due by the beginning of next lecture
no deadline per exercise, but must do them all by the end of the course

Microquizzes are in the last 30-45 minutes of specific lectures outlined in the calendar. What happens if you cannot make it to a microquiz?
Email S^3 and post to the forum to schedule a conflict microquiz
Conflict microquizzes are not given but the lowest quiz grade is dropped

You are working with a friend on the problem set. Your friend tells you to use a specific kind of loop to solve a part. Is this a collaboration violation?
Yes for you and the friend
Yes only for the friend
Yes only for you
no

You are stuck debugging the problem set. Your friend 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?
Yes for you and the friend
Yes only for the friend
Yes only for you
no

3) Setting Up Python ('sup)

The rest of this problem set guides you through setting up your Python environment, writing a simple Python program, and submitting it on our website. Be sure to read the instructions thoroughly, especially the Collaboration and Hand-in Procedure sections. Your submission will not be graded, but subsequent problem sets will rely on this understanding.

3.1) Collaboration

You may work with other students, but each student should write and submit their Python program individually. For details, refer to our Collaboration Policy in Section 6 of the course info page. Be sure to indicate those whom you worked with in the comments near the top of your submission.

3.2) Installing Python via Anaconda

The Getting Started handout (found in the zip file above) provides instructions for installing the Anaconda Distribution of Python and using the Spyder integrated development environment (IDE) that comes with it. You are not required to use Anaconda or Spyder, but we recommend this setup for first-time programmers, due to the ease of installation and the bundled packages. Alternatives to Spyder include VSCode and PyCharm, but we do not officially support them (yet).

This class uses Python version 3.6 or higher. No matter what setup you use, make sure the version number displayed in the Python terminal/console meets that requirement. (And you should definitely avoid Python 2.x, as Python 3 is not backwards compatible.)

If you choose not to use Anaconda, make sure you also install the following Python packages, typically through pip:

  • matplotlib
  • numpy
  • pandas
  • scikit-learn
  • Pillow

Otherwise, these are all included when you install Anaconda. Familiarize yourself with basic Python and the Spyder IDE using the exercises in the handout. Once you are ready, proceed to the programming task below.

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

The goal of this exercise is to get you comfortable using simple elements of Python. Such elements include the ability to print out results (using the print operation), the ability to read input from a user at the console (using the input function), and the ability to store values in variables, so that the program can access those values as needed.

In the file named ps0.py, write a program that does the following in order:

  1. Ask the user to enter a number x.
  2. Ask the user to enter a number y.
  3. Print out number x, raised to the power y.
  4. Print out the log (base 2) of x.

An example run of the program is shown below. The numbers printed after :   are instances of a user's input. The rest are should be printed by your program.

Enter number x: 2

Enter number y: 3

x**y = 8
log(x) = 1.0

Hints:

Most of the functionality you need is demonstrated in Lecture 1, and the Getting Started handout has examples of accepting input and calculating logarithms. For more examples of how to use the functions you need, see the following pages on Wikibooks and Numpy's documentation:

4) Hand-in Procedure

4.1) Save

Save your code in ps0.py. Do not ignore this step or save your file with a different name.

4.2) Time and Collaboration Info

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

# Problem Set 0
# Name: Steven Spielberg
# Collaborators: Kathleen Kennedy, George Lucas
# Time Spent: 3:30

... your code goes here ...

4.3) Submit

Upload your ps0.py file via the Select File button. Then click the Submit button. Refresh the page, and verify via the Download Most Recent Submission link above Select File that the correct file was uploaded.

When you upload a new file, your old one will be overwritten. You may upload new versions of each file until the 9 PM 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.

  No file selected