Watch the videos below, read through Section 4.1 through 4.3 of the Python Tutorial, and complete the assigned programming problems. Please get started early, and come to office hours if you have any questions!
Recall that to make notebook cells that have Python code in them do something, hold down the 'shift' key and then press the 'enter' key (you'll have to do this to get the YouTube videos to run). To edit a cell (to add answers, for example) you double-click on the cell, add your text, and then enter it by holding down 'shift' and pressing 'enter'
This assignment is due by 11:59 p.m. the day before class, and should be uploaded into the "Pre-class assignments" dropbox folder for Day 3. Submission instructions can be found at the end of the notebook.
In [ ]:
# Imports the functionality that we need to display YouTube videos in a Jupyter Notebook.
# You need to run this cell before you run ANY of the YouTube videos.
from IPython.display import YouTubeVideo
In [ ]:
# Display a specific YouTube video, with a given width and height.
# WE STRONGLY RECOMMEND that you can watch the video in full-screen mode
# (much higher resolution) by clicking the little box in the bottom-right
# corner of the video.
YouTubeVideo("cozbOliNwSs",width=640,height=360) # Boolean logic and if statements
Question 1: Write a program that compares three variables v1, v2, and v3 (not necessarily the variable names) and does the following using if statements:
Try several values of v1, v2 and v3 and ensure that you see the correct behavior.
In [ ]:
# write your program here, using multiple cells if necessary (adding extra cells using
# the 'Cell' menu at the top of this notebook). Don't forget that you can execute
# your program by holding down 'shift' and pressing 'enter' in each cell!
In [ ]:
# Don't forget to watch the video in full-screen mode!
YouTubeVideo("VnTN5sFIPD0",width=640,height=360) # loops in python
Question 2: Write two small programs that do the following:
In [ ]:
# Program 1 here
In [ ]:
# Program 2 here
In [ ]:
# Program 3 here
Put your answer here!
Question 4: Do you have any further questions or comments about this material, or anything else that's going on in class?
Put your answer here!
Question 5: How long did this assignment take you to complete?
Put your answer here!
In [ ]: