The goal of this lab assignment to allow you to explore the hardware in the computing devices you regularly use and to practice writing some basic interactive Python programs.
For this assignment, record your work in a Jupyter Notebook and upload it to the form below by 11:59 PM Friday, January 25.
Before working on this lab assignment, you will first need to install the Anaconda distribution of Python, which will allow you to execute Python code in the comfort of your favorite web browser. Additionally, you will need to download a starter Jupyter Notebook that provides a template for your lab assignment.
In order to do the lab assignments in this course, you will need to install the Anaconda distribution of Python.
Download the Anaconda distribution from the following location:
https://www.anaconda.com/download/
Make sure you select the Python 3.7 version and not the 2.7 version.
Install the Anaconda distribute to your laptop or local computer.
If you need help, you can refer to the Anaconda Installation Documentation.
Once Anaconda is installed, you can launch the program and open the Jupyter Notebook interface. This will open in your default web browser (ie. Chrome, Firefox, Safari, or Explorer).
To help you get started, we have provided you with a starter notebook, which you can download and then use to record your answers. To utilize the starter notebook, download it to wherever you are running Jupyter Notebook and then use the Jupyter Notebook interface to open the downloaded file.
The starter notebook is already formatted for all the various sections you need to fill. Just look for the red instructions that indicates were you need to write text or the cyan comments that indicate where you need to write code.
For the first activity, you are to compare and contrast the various computing devices you use on a regular basis, such as the following:
After identifying which three machines you wish to investigate, you are to do the following:
Gather hardware information for each device (including vendor, CPU, RAM, Storage, and I/O).
To do this, you will need to search through the device system settings for information about the hardware:
For phones and tablets, you can search for the hardware information using a query such as "Moto G3 specs" to find the normal hardware specifications for your device.
Run a benchmark program to measure the performance of each device (ie. JetStream web benchmark).
To do this, you will need to go to the JetStream benchmark website (ie. "https://browserbench.org/JetStream/") on each device and run the benchmark to generate a Geometric Mean.
To even the playing field, try to use the same browser on each device. For instance, if you use Google Chrome on your laptop, then also use Google Chrome of your phone as well. Otherwise, the results may be more representative of the particular browser you chose, rather than the underlying hardware.
Record the device information you gathered and the benchmark results you produced in two separate Markdown tables as shown in the starter notebook.
Because performance is an important metric in computing, benchmarking is a popular activity in computer science. Unfortunately, good benchmarking is not straight-forward and there are usually many variables that can impact the result of a benchmarking measurement.
In this case, the JetStream benchmark can be impacted by not only the underlying hardware but also the operating system, the power management strategy, the browser version, and many more environmental issues. That said, even though the JetStream benchmark is not a perfect measurement of hardware performance, it will be good enough for our purposes (and sometimes, that is all we need).
After you have gathered information about your computing devices and performed the benchmarks, answer the following reflection questions in your Jupyter Notebook:
From a hardware perspective, how are your computing devices similar? How are they different?
What were the results of your benchmarks? What is your takeway regarding computing hardware that you get from these results?
Each response should a few sentences and use the information from the tables you created as support for your answers.
Markdown is a convenient short-hand language for producing HTML documents. The Jupyter Notebook supports both Markdown cells and Python cells. We will be using the Markdown cells for writing formatted text in the Jupyter Notebook. For more information about Markdown, you can look at the following resources:
For the second activity, you are to write two short Python programs that incorporate reading input from the user, formatting text, and performing basic mathematical computations.
The first program is a modification to the classic "Hello, World!" program:
>>> print("Hello, World!")
Hello, World!
Instead of just printing "Hello, World!"
, you are to use the input
function to read in a name variable, and then use this variable to
display "Hello, {name}!"
.
A typical execution of your program should look like this:
What is your name? Peter
Hello, Peter!
As discussed in class, programming doesn't necessarily require advanced math skills. That said, we could always write programs to do math for us when we run into tricky math problems. For the second program, you are to write an interactive math formula calculator for any of your favorite math equations:
For instance, here is the execution of a program that computes the area of a rectangle based on its length and width:
What is the length of the rectangle? 5
What is the width of the rectangle? 4
The area of the rectangle with length (5) and width (4) is 20.
Note, your program must utilize at least one variable that it reads from the user and then format a sentence with the result of the equation.
Don't worry about writing the whole program all at once. Instead, focus writing one line at a time in different Python cells and testing each command. Once you understand how things are working, you can combine the different lines into one cell and then remove any experimentation you did.
The process of programming is often filled with trial and error and a lot of experimentation, so don't worry if you find yourself constantly trying new things or modifying previous work. The key is to understand the modifications you are making and understanding why you get better results.
Here are some hints to help you with the assignment.
You can use a variable assignment to store the result of the input function.
x = input('What is the value of x?')
The input function returns a string. Since we will be doing mathematical operations, you will need to convert the data into either an int or a float:
x = int(x)
You can also use variable assignment to store the result of a mathematical expression:
total = x + y
You can format a string by using the format string method as so:
print('Total = {}'.format(total))
With Python 3.6, you can simplify this to:
print(f'Total = {total}')
Once you have completed your lab, submit your Jupyter Notebook using the form: