CSCI1200 Homework 1 — Hello, computers!




5/5 - (1 vote)


– Learn how to turn assignments in on Canvas – Learn how to run, save, and rename files in Jupyter Notebooks – Practice formulating problems as pseudocode – Learn about an event in computer history – Explain how some parts of computers work – Practice print commands and type operations

Turn In:

– hw1_written.pdf – hw1_code.ipynb You should turn these files in on canvas under the “Homework 1 – Hello, computers!” link. Make sure to double check everything on the following checklist: ❏ Your files are named hw1_written.pdf and hw1_code.ipynb ❏ You’ve fully submitted the file by uploading to canvas and pressing “submit assignment” after you upload it!

❏ You’ve submitted the correct files (download what you submitted, re-open them, and verify!) ❏ hw1_written.pdf is one single pdf that includes your name ❏ hw1_code.ipynb is commented as described below ❏ hw1_code.ipynb produces no errors and runs all cells when you click “restart kernel” then run all the cells from top to bottom

Part 1: Written responses (hw1_written.pdf)

For this part, answer the questions below using the word processor of your choice, save the file as a pdf, and submit the file on canvas. Make sure to proofread your answers and include your name at the top of the file that you submit.

Question 1 (5 points): Pseudocode We’ve been exploring describing strategies to solve problems in English in the lab (picobot) and in class. Sometimes, even if you don’t know how to code solutions to problems, you can still describe what you would need to do in order to solve them. We call this process “writing pseudocode”.

For this problem, you’ll write down your strategy for covering a new room with a picobot. Your strategy should be written as a flowchart. For example, one solution to the square room for picobot (the room that you worked on in Lab 1) in flowchart format might look like: Notice that we can use both arrows and words to indicate what steps need to be repeated.

Describe how you would solve the following problem in flowchart format: Write the pseudocode (rules in english) for picobot to solve a room of the shape outlined below. An example picobot is shown in the room, but remember that you don’t know where in the room you will start! (Look at Lab 1 or come to office hours to remember how picobot works.)

Question 2 (5 points): Computer History Choose a significant event, person, or discovery/invention from computer history (anything before 1980) that was not covered in depth during lecture and research it/them. You can use any resources you want to conduct your research, but you must cite your sources.

Write one or two paragraphs (approximately 250 – 500 words, not including citations) about your chosen event/person/discovery. Who are they? Why is it important? When did this happen? Why should we care?

Question 3 (5 points): How Computers Work Choose TWO (2) components of a computer to research. Some examples are the motherboard, RAM, hard drive, CPU/processor, video card, or peripherals (mouse, keyboard, monitor, speakers).

How does this component work? Why is it important? (150-200 words per component). Make sure to include a list of citations for the sources that you consulted. We will explore this topic further during Lab 2 (September 1st/2nd), so if you don’t know where to begin, waiting until after you’ve had lab this week will be helpful for you!

Part 2: Writing Code (hw1_code.ipynb)

For this part, download hw1_starter.ipynb, rename this file to hw1_code.ipynb, and complete the questions as described below. For full credit, you must also include a comment at the top of your notebook as follows.

Remember that any line that begins with a # is a comment and is just there for informational purposes. # Name: # Section: # Homework: # Description: To earn full credit, your notebook must run without errors, include a comment with your name at the top of your file, and contain completed exercises.

Question 4 (3 points): Introduce yourself to your TA Write a program that uses print()statements to introduce yourself to your TA. You must use at least 3 print()statements.

Question 5 (2 points): Exploring print() What happens when a python print() statement with nothing between the parentheses is executed? Make sure to leave the code that you used to figure out the answer to this question in your notebook.

Question 6 (10 points): Exploring Data Types and Operations Read section 3.1 of the Course Notes. Here, you will learn about data types in python and what kinds of operations we can do with different data types.

This is material that we haven’t covered in lecture yet, so be sure to take advantage of the Course Notes and the supplementary online textbook (both linked from canvas!). Fill out the following table with the results of the following operations between the listed types: Use your jupyter notebook to test out different combinations! Make sure to comment out any code that produces errors (but do leave it in your notebook so that we can see your experiments!).

operator result? int + int int int + string TypeError int + float int * float int / int int // int float * float float // int float + string string + int string * int string / int

Question 7 (Extra Credit – 5 points): Explore the Modulo (%) operator Explore how the modulo operator works for int values. Use the jupyter notebook to experiment with two different examples. Write a short comment for each example explaining the output.