#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Felix Muzny 9/9/2022 DS 2000 Lecture 1 - introduction, variables, arithmetic While you get settled: One tool that you'll see me use often is a Poll Everywhere question. Three ways to participate (please do one of these!) 1) via the PollEverywhere website: https://pollev.com/muzny 2) via text: text "muzny" to the number 22333 to join the session 3) via Poll Everywhere app (available for iOS or Android) Here is the question that you are answering: ****** Question: is this your last class of the day on Fridays? A. yes! B. no! C. what is time? D. my schedule is still changing E. I like the letter E ****** Question: what is your favorite breakfast food? A. oatmeal B. eggs C. toast D. pancakes E. bagels With a diff. neighbor than last time 1. name 2. (pronouns) 3. what year you are here at northeastern 4. share your fav. breakfast food Logistics: - Your first due dates will be next Friday (9/16) - Quiz 1 (will be released Tuesday, we'll talk about this Tuesday) - quizzes are intended to be lecture reviews. I recommend doing these Tuesday night :) - Homework 1 (we'll talk about this at the end of lecture today) """ """ Anatomy of a lecture w/ Prof. Felix --- 1. Please come to lecture ready to participate 2. I like to use various activities throughout lecture. I do this so that I can check your understanding as a whole class. (and for fun!) One tool that you'll see me use often is a Poll Everywhere question. Three ways to participate (please do one of these!) 1) via the PollEverywhere website: https://pollev.com/muzny 2) via text: text "muzny" to the number 22333 to join the session 3) via Poll Everywhere app (available for iOS or Android) The question will always be the following: Answer a multiple choice question A. A B. B C. C D. D E. None of the above Here's how it works! I'll display a question with answer options. Once I've cleared the responses for the next question, you'll be able to submit your answer to the next question """ """ Welcome to DS 2000! Who am I? - Felix Muzny ("muse-knee") - (they/he) - 3rd year at neu - from Colorado - studied english literature and computer science Who are you? What is this class? - learning python basics - exploring data w/ computers - how to gather, structure, organize data - applying data/data analysis in real world situations - learning a new way to think about problems & come up with solutions Road map: how do we get to data? - start with python fundamentals - our first data sets are going to be teeny teeny tiny """ """ *Pause* What are the resources for this class/where can I find the things? - website (for everything) https://course.ccs.neu.edu/ds2000/ - Canvas (to look at your grade, eventually) - Gradescope (to submit your homework) - Piazza (course discussion board) It's a lot of things! I recommend bookmarking the website and piazza. We'll always link to the items that you need from the course website. :) """ """ * Pause #2 * Spyder demo/introduction Please come to office hours if you are having any installation difficulties with spyder! 1. "this area" - where I am currently typing is the file editor 2. interpreter/repl - playground/test bed """ """ Anatomy of Prof. Felix's lecture notes --- This is a python program! It is *also* where you can expect to find my notes for class for each day. I like to put blocks of notes that go together between sets of triple quotes (more about this in the "Anatomy of a python program" section) When there is a specific section of the textbook or notes that I think goes nicely along with a topic, I'll do my best to make a note of it like this: (Deitel & Deitel 2.2) - for Intro to Python (Downey 2.1) - for Think Python (Muzny 2.1 [link]) - for Felix's Python notes """ """ Anatomy of a python program --- python: the programming language that we're working with - essentially human-readable commands that your computer can translate into (hopefully) useful manipulation of bits bit: a 0 or a 1 ("off-ness" and "on-ness") - everything is represented as bits in the end - these corresponds to "no electricity" vs. "electricity" happening python program: a file on your computer that contains commands in the python programming language. Ends with the extension .py this tells your computer "hey! please run this file using the python interpreter!" python interpreter: the software that you installed on your computer that translates python commands into actual manipulations of bits on your computer """ """ Writing our first program! --- Python programs consist of *two* kinds of statements: 1) comments - for humans! - for information for your TAs and Profs - for future you - for other programmers/users a) # this is a single line comment b) with triple quotes (three quotes in a row) 2) executable lines - for the computer - make things happen Python programs run top to bottom. Comments are ignored Executable lines are run So far, everything in this file has been: comments """ # this is a single line comment """ this comment might be longer! """ """ Displaying information: print() (Deitel & Deitel 2.4) """ print("Number of peaches Felix ate this summer:") print(789) print(789 * 6) # print a blank line print() # Question: if I removed the quotes on the first print # what would happen? # A. error <---- # B. no change in output # C. a change in output (but no error) # D. something else? # Question: if I commented out (change into comments) # the print() lines that I have, what will happen? # A. error # B. no change in output # C. a change in output (but no error) <---- # D. something else? # General strategy: # 1) make a guess/hypothesis # 2) test it out! """ Variable assignment (Deitel & Deitel 2.2) variable_name = value - not the same as = in math! - variable names cannot start with numbers - variable names cannot contain spaces """ print("variables:") cats = 3 dogs = 2 print(cats) print(dogs) print(cats + dogs) animals = cats + dogs # animals = 2 + 3 x = 4 * 9 #4 * 9 = x """ Arithmetic operators (Deitel & Deitel 2.3) +, -, * (multiply), **, /, //, % """ """ Homework 1: - There are 3 problems - each asks you to get some information from the user (we'll do this a lot in class on Tuesday), then do some calculations - to get started, let's do an example """ """ Example problem 1: Write a program that asks the user how old they are, then prints this number out. """ age = 31 print("Your age:") print(age) """ Example problem 2: Write a program that asks the user how many apples they would like to eat each day, then calculates how many apples they should buy per week. """ apples_per_day = 3 apples_per_week = apples_per_day * 7 print("you should buy:") print(apples_per_week)