Assignment1: Welcome aboard! ¶

Cs240 bryn mawr college professor blank ¶.

Welcome aboard to CS240: Priciples of Computer Organization!

Due: Wednesday, Sep 2, 2015, 2:40pm. Print out, and bring to class.

This first assignment introduces a number of new things:

  • can enter text and code
  • 1111 0000 00100101 - halt
  • 000, 001, 002, etc.

Read Chapter 1 ¶

Read chapter 1, and write down 6 questions for discussion in class on Wednesday, Sep 2:

Our first Machine Language Program ¶

For this, our "Hello, World" program in Machine Language, our goal is to:

We create a machine language program by putting machine language code in a Jupyter cell, and pressing Shift+Enter, or pressing the triangle button at top of page. This will assemble the code and place it into memory.

A machine language program always starts with where in memory the code should be placed, its "origin". We'll often use x3000 as a generally open place in memory, but it could be anywhere. We use the .ORIG directive.

Then, we enter all of the machine language instructions (see next).

Finally, we signal to the assembler that this is the end, using the .END directive.

Instructions ¶

For our first program, we will use two instructions: add and halt .

The add instruction always starts out with 0001. Then it is followed by the destination register, as source register, the number 1, and a 5-bit binary number.

In shorthand, it does this:

Halt ¶

The halt instruction is long, but specific:

There are variations of this command, but for now, we'll just use it as it is.

Putting it all together ¶

Now we just put the .ORIG, code, and .END together in a cell, and press Shift+Enter:

There, you just assembled your first program! What you are seeing is:

But we didn't actually run the program. To do that, we use a Jupyter Calysto LC3 magic, %exe. Enter %exe in a cell, and press Shift+Enter:

You just ran your first machine language program! What did it do? Just what we told it:

So, if it worked correctly, you should see R0 has the value 1.

You can run it again:

And now R0 contains 2.

To reset the register, use:

So, to reset register 000 to 0 use:

You can continue to run it again, or set registers to different values.

Questions ¶

For the following questions, using only the add instruction, do the following:

computer assignment 1 ipynb

Name already in use

Cadl / session-1 / session-1.ipynb.

Jupyter notebook Assignments/Assignment 2 - Intro to Python/programming-1.ipynb

Programming I - Intro to Python

Welcome to your first notebook of the semester! Throughout the semester, you'll be using Jupyter Notebooks like this one to learn practical skills in data analysis. The notebooks will consist of brief tutorials that reiterate some of the concepts you've learned in class, along with some basic exercises that test you on some of these skills. Notebooks will be assigned most weeks during the semester, and are due the following week.

This notebook includes a series of exercises to introduce you to the basics of programming in Python. You'll learn, in general terms, about data types in Python, and how to make basic manipulations of these data types.

Python is rapidly becoming the introductory programming language of choice at universities across the country, and for good reason. This is aptly summed up in the popular web comic XKCD :

Python combines simplicity of syntax with relative computational power, which makes it an attractive language of choice for many programmers. The classic introductory programming problem is how to get a language to return the phrase, "Hello world." In the Java language, for example, it looks something like this:

Compare that with Python:

Much simpler! Now, Python is not always going to be your language of choice for every application. Python is an example of an interpreted programming language, which means that it is converted on-the-fly to machine code - that is, code your computer can understand. This can make development simpler, but generally executes slower than compiled languages, in which the source code must be run through a compiler before it is executed. This additional step, however, can speed up execution substantially, which is why compiled languages like Java, C, or C++ are sometimes preferred for software development.

However, Python is an outstanding choice for data analysis, which is highly interactive and requires the testing of many different ideas on-the-fly. Indeed, the Python community has built a robust infrastructure for data analysis with the language, which includes the Jupyter Notebook, which we are working in right now.

The Jupyter Notebook is an example of literate programming , in which documentation and computer code are tightly integrated. The notebook itself is comprised of "cells" that either accept Python code, or text written in Markdown , a highly-simplified syntax for writing HTML code. To choose a Python or Markdown cell, simply change the option from the drop-down menu at the top of the screen. To "run" the contents of your cell, click the "run cell" button from the menu at the top of the screen, or use the keyboard shortcut Shift+Enter.

Tools like the Jupyter Notebook are an excellent way to document your workflow, and make your work reproducible. Over the course of a data analysis, it is often challenging to remember every small step you have taken, or the rationale behind those steps. With the notebook, you can include descriptions of your workflow along with the actual code you used to do your data analysis.

Python basics

You already saw how to print text using Python using the print command. Now, I'm going to take you through a few of Python's basic data structures. At its most basic level, Python can function like a calculator. For example, I can type in a simple calculation...

...and I get 4. Try it out yourself!

In addition, Python can work with strings , which are textual representations of data. Strings are enclosed in single quotes ' ' or double quotes " " . Like numbers, strings can be "added" together; however, instead of performing a numeric computation, Python will concatenate the strings, combining them. Take the following example:

Now, let's see what happens when we try to combine a string and a number:

We get an error message back - 'str' and 'int' objects cannot be concatenated, as they are different data types. However, we can convert between different data types by converting our objects. For example, the str command converts to a string, the int command converts to an integer, and the float command converts to a floating-point number, if possible. Let's try it out:

You now have a very basic sense of how Python works. To this point, every cell that we've run has directly accepted content. However, in your work with Python, you are going to want to store information that you'll need to come back to later, or re-use certain objects in your code. As such, you will want to work with variables .

Variables are Python objects that represent some other thing. They can be just about any Python data type (more on these data types later) and are defined through assignment with the equals (=) operator. Let's give it a try:

In the above cell, I assigned the integer 4 to the variable x. When I asked Python to print the variable x, it returns the integer 4, which is what is represented by x.

If you've programmed in other languages before, you probably noticed that I didn't have to declare the type of my variable when creating it. Python is an example of a dynamically typed language, which means that the types of objects are mutable (can change) and do not need to be declared. Instead, Python detects the type of the object based on the assignment I made. Let's check it out with the type command.

Python knows that x is an int (integer) as I assigned an integer, 4, to x. Other languages, like Java, are known as statically typed programming languages, as object types need to be declared. For example, assignment in a statically typed language might look like this:

In my opinion, the dynamic typing of Python makes it well-suited for the exploratory nature of data analysis.

As my variable x is an integer, I can perform mathematical operations with it. For example, I can multiply it by two with the * operator, or raise it to the second power with the ** operator:

Variable types can also be converted to other types through conversion , like I showed your earlier. Conversion operators in Python include int (integer), long (long integer), float (floating-point number), and str (string/text).

Let's give it a try. In the space below, we'll create a new variable y by converting your variable x to a string. Then, we'll type y and run the code to see what we get.

We see a '4' returned in quotations -- this means that your variable y stores the value 4, but in string rather than number format. As such, we cannot do math with our new variable...

Now, try it out yourself! Create a new variable, z , by converting y to a floating-point number, and then divide z by 3. What do you get?

You should have a sense to this point of the flexibility of variable assignment in Python. However, to this point we've only been working with variables that store one value - and you'll be working a lot with multiple values in Python.

The most common data structure for multiple values in Python is the list . Lists are enclosed in brackets [], and can contain a series of values, objects, variables, etc. Objects in a list need not be of the same type; however, keeping the types within lists consistent will maximize what you can do with them.

Let's take a look at a sample list of numbers, and assign it to the variable mylist .

To retrieve specific elements within my list, I can use indexing . Indexing is a common operation in Python to subset your data - this will be very important for you when working with datasets later on. Indices are similarly enclosed in brackets. In Python, the index starts at zero; as such, 0 returns the first element, 1 the second element, and so on. Let's try it:

Chunks of your list can also be retrieved through slicing . To slice a list, index with the first element you want, followed by a colon : operator, then the index of the first element you do not want . For example, let's retrieve the second through fourth elements of mylist , which should give us back 4, 6, and 8.

You can also add other lists to your lists. Let's try it:

This can also be achieved with the append command, which will modify the existing list.

Notice that the append command shows up as a property of your list - that is, a method you can use to modify it. In the Jupyter Notebook, you can get a list of possible methods for your list by pressing Tab after typing a period after your list's name. Try it out:

Notice a series of methods available to you to manipulate the contents of your list. You can read more about the different list methods here .

Let's try a couple:

Now, try working with a list of your own! Do the following:

Create a list of four numbers - one through four - and assign it to a variable.

Index the list to return only 3 and 4

Add a second list of 5, 6, and 7 to your list

Insert the number 12 at position 3 of your list

Strings, or textual representations of data, have a series of special methods that allow for their manipulation. In the Jupyter Notebook, these methods are available by pressing the Tab key after typing a period after the variable that stores the string. Let's test it out.

Notice all the different methods available to you; you can view them in detail here . In the IPython notebook, you can also see the parameters of the different methods by typing Shift + Tab after typing the first parenthesis. Let's try a few.

Like lists, strings can also be indexed or sliced; in this instance, the index refers to the different characters in the string.

Every notebook you are assigned each week will culminate with a series of exercises to help you solidify your skills in programming, data analysis, and visualization. You are welcome to work together on these exercises. However, if someone is giving you help, be sure that you can replicate it yourself! Also, recall our course discussions about frustration: getting frustrated just means that you are pushing your limits!

Exercise 1 : Create a new cell below with the "Insert Cell Below" option. Change the cell type to Markdown from the drop-down menu at the top of the screen. Practice writing some Markdown in the cell. The cell should include a numbered list of links to your five favorite websites, with an H2 header for the title. The links should not simply be the website URLs, but should instead show the name of the website, which you can click to get to the website. Also, make the name of the first entry in bold, and the name of the second entry in italics.

For Markdown tips, take a look at the Markdown cheatsheet at this link . Also, a tip : you can view how I wrote Markdown in any of the cells in this notebook by double-clicking the cells!

My favorite websites

Exercise 2 : Assign the number 31 to a new variable, q . Write an expression that raises q to the 4th power and run the cell.

Exercise 3 : Create a new variable, smu , and assign the lowercase string 'southern methodist university' to it. Use Python string methods to capitalize your string appropriately. Add a comment in your code that explains what you did.

Exercise 4 : Assign the list ['a', 'b', 'c', 'd', 'e'] to a variable. Reverse the list, then insert 'z' at index 3, and finally append 'o' to the end.

Exercise 5 : (Modified from your textbook): A string slice can use an optional third index to specify the 'step size', which refers to the number of spaces between characters. Your textbook gives the following example:

The same result could be achieved, however, by omitting the 5, as the above example uses the whole string:

In the cell below, I will provide you with a string of characters that may appear quite random at first. Run the cell to assign the string to the variable code . However, the string is in reality an encoded message, in which the character to keep is at every fourth character .

Use Python string slicing to decode the message, and print the result to your notebook. The result is a familar expression, so if you are not getting a result that makes sense, try again!

Hint : remember rules about Python indexing, which starts at 0, not 1!

computer assignment 1 ipynb

Assignment 1

In this assignment, you will first learn how to use PyTorch on Google Colab environment. You will then practice putting together a simple image classification pipeline, based on the k-Nearest Neighbor, and finally will learn how to use Autograder for evaluating what you implement. The goals of this assignment are as follows:

This assignment is due on Friday, January 14, at 11:59 PM EST .

Q1: PyTorch 101 (60 points)

The notebook pytorch101.ipynb will walk you through the basics of working with tensors in PyTorch. You are required to write code on .

Q2: k-Nearest Neighbor classifier (40 points)

The notebook knn.ipynb will walk you through implementing a kNN classifier. Your implementation will go to .

1. Download the zipped assignment file

2. Unzip all and open the Colab file from the Drive

Once you unzip the downloaded content, please upload the folder to your Google Drive. Then, open each *.ipynb notebook file with Google Colab by right-clicking the *.ipynb file. No installation or setup is required! For more information on using Colab, please see our Colab tutorial .

3. Open your corresponding *.py from Google Colab and work on the assignment

Next, we recommend editing your *.py file on Google Colab, set the ipython notebook and the code side by side. Work through the notebook, executing cells and implementing the codes in the *.py file as indicated. You can save your work, both *.ipynb and *.py, in Google Drive (click “File” -> “Save”) and resume later if you don’t want to complete it all at once.

While working on the assignment, keep the following in mind:

4. Evaluate your implementation on Autograder

Once you want to evaluate your implementation, please submit the *.py and *.ipynb files to Autograder for grading your implementations in the middle or after implementing everything. You can partially grade some of the files in the middle, but please make sure that this also reduces the daily submission quota. Please check our Autograder tutorial for details.

5. Download .zip file

Once you have completed a notebook, download the completed file, which is generated from your last cell of the knn.ipynb file.

Make sure your downloaded zip file includes your most up-to-date edits ; the zip file should include pytorch101.ipynb , knn.ipynb , , for this assignment.

6. Submit your python and ipython notebook files to Autograder

When you are done, please upload your work to Autograder (UMich enrolled students only) . Your ipynb files SHOULD include all the outputs.

University of Waterloo logo

Assignments Data-Intensive Distributed Computing (Winter 2023)

Note that there separate sets of assignments for CS 451/651 and CS 431/631. Make sure you work on the correct asssignments!

CS 431/631 Assignments

Assignment 0: Warmup due 4:00 pm Jan 18

This assignment is a warmup exercise to get you familar with some of the basic tools you will need for the remaining assignments. In particular, we will be making use of Python (for programming) and Jupyter notebooks.

The general setup is as follows: for each assignment, you will be provided with a "starter" notebook, which will describe what needs to be done for that assignment. You'll complete the assignment in the notebook, and then submit your notebook to a private Git repository. Shortly after the assignment deadline, we'll pull your repo for marking.

You already have an account on GitLab accessible at hosted by the Univeristy of Waterloo. You should be able to log in using your userid and WatIAM password. Create a private repo called bigdata2023w . If you are not familiar with GitLab, there are many resources online that you can use to learn basics of Git.

Python and Jupyter

All of the programming required for the assignments will be in Python. If you have never programmed in Python before, you will need to gradually bring yourself up to speed. There are many on-line resources that can help with this. A good place to start is . In particular, you can start with their Python Tutorial . If you don't like that particular tutorial, there are many others to choose from . There are also many Python books to choose from, if you prefer to learn that way. Choose a book that fits your needs. For example, some books target people who are migrating to Python from other languages, while others are directed at novice programmers.

Most Python tutorials expect you to try out examples as you go along, i.e., they expect you to write and run Python code. This kind of active learing is definitely the way to go. The simplest way for you to run Python code is by using a Jupyter notebook running on Google Colab (see below). This will allow you to run Python in a web browser, without having to install any software on your machine. If you wish, you can also install Python locally on your own machine. Python is freely available for a variety of platforms . Bear in mind that all assignments for CS431/631 will be done using notebooks, so it is not a bad idea to get used to them.

Jupyter Notebooks

For this course, you will be writing and running Python code in Jupyter notebooks . Each notebook consists of a sequence of cells . An cell can hold (formatted) text, Python code, or graphics. A great thing about notebooks is that you can open and run them in a web browser. This means that you can work on your own machine, using only a web browser, without having to install any additional software.

Assignment Workflow

Assignment 0

Submitting assignment 0.

Back to top

James C. Sutherland

3603 – homework, submitting homework.

Submit homework assignments via gradescope . 

By submitting homework, you certify that your solution represents your own work. Submitting others’ work constitutes cheating and will result in automatic failure of this class.

Homework Submission Instructions

To receive credit for a homework assignment, ensure that you follow these rules:

Homework Resources

Jupyter Notebooks

Cloud-based access (recommended).

Local installations

Some Jupyter Resources

Python Resources

LaTeX information:

Here is a useful web page that provides the LaTeX command to generate numerous mathematical symbols .

Coming from Matlab

Homework Assignments

Leave a Reply Cancel reply

You must be logged in to post a comment.


  1. Computer Assignment Cover Page Templates for MS Word

    computer assignment 1 ipynb

  2. Laptop computer assignment form in Word and Pdf formats

    computer assignment 1 ipynb

  3. Assignment # 1 c++ computer system and Programming EC-105

    computer assignment 1 ipynb

  4. Computer Assignment 1

    computer assignment 1 ipynb

  5. Computer Assignment 5

    computer assignment 1 ipynb

  6. Computer Assignment 3 ALU

    computer assignment 1 ipynb


  1. Computer Assignment File UP DELED 1st Semester

  2. Logical operators

  3. Break and Continue

  4. ASMR Coding: Solving Python Puzzles (Advent of Code 21

  5. Import in Python

  6. Pandas 1


  1. Assignment1.ipynb

    Welcome aboard to CS240: Priciples of Computer Organization! Due: Wednesday, Sep 2, 2015, 2:40pm. Print out, and bring to class. This first assignment

  2. Coursera/Assignment 1.ipynb at master

    Assignment 1 - Introduction to Machine Learning¶. For this assignment, you will be using the Breast Cancer Wisconsin (Diagnostic) Database

  3. CADL/session-1.ipynb at master

    Assignment: Creating a Dataset/Computing with Tensorflow ... Click the file "session-1.ipynb" and this document will open in an interactive notebook

  4. CoCalc -- Assignment1.ipynb

    Computer Assignment 1---MATH4006 ... import math # for sqrt (could also used x**(1/2) which would not require import) iterates = [] #declare an empty list N

  5. CoCalc -- programming-1.ipynb

    Path: Assignments/Assignment 2 - Intro to Python/programming-1.ipynb ... converted on-the-fly to machine code - that is, code your computer can understand.

  6. assignment_jheaton_class1.ipynb

    A computer program will automatically check your data, and it will inform you ... For example, for assignment 1, you should have _class1 somewhere in your

  7. Instructions for Assignment 1: Please download the following python

    Question: Instructions for Assignment 1: Please download the following python (ipynb) file. Upload the file into Jupyter. Then follow the instruction

  8. Assignment 1

    Your ipynb files SHOULD include all the outputs. EECS 498-007 / 598-005: Deep Learning for Computer Vision. Justin Johnson

  9. Assignments Data-Intensive Distributed Computing (Winter 2023)

    ipynb: this is the starter notebook for A0, in which you will do your assignment work. Files with names that end in .ipynb are Python notebook files. When you

  10. 3603

    Homework Submission Instructions. Each problem should be solved in a separate Jupyter notebook. Submit both the Jupyter notebook (.ipynb) and a PDF copy of