Difference between revisions of "EGR 103/Concept List Fall 2019"

From PrattWiki
Jump to navigation Jump to search
Line 2: Line 2:
 
   
 
   
 
== Lectures ==
 
== Lectures ==
* Lecture 1 - Introduction
+
=== Lecture 1 - Introduction===
** Class web page: [http://classes.pratt.duke.edu/EGR103F18/ EGR 103L]; assignments, contact info, readings, etc - see slides on Errata/Notes page
+
* Class web page: [http://classes.pratt.duke.edu/EGR103F18/ EGR 103L]; assignments, contact info, readings, etc - see slides on Errata/Notes page
** Sakai page: [https://sakai.duke.edu/portal/site/egr103f18 Sakai 103L page]; grades, surveys and tests, some assignment submissions
+
* Sakai page: [https://sakai.duke.edu/portal/site/egr103f18 Sakai 103L page]; grades, surveys and tests, some assignment submissions
** Piazza page: [https://piazza.com/duke/fall2018/egr103/home Piazza 103L page]; message board for questions  
+
* Piazza page: [https://piazza.com/duke/fall2018/egr103/home Piazza 103L page]; message board for questions  
* Lecture 2 - Programs and Programming
+
=== Lecture 2 - Programs and Programming===
** To play with Python:
+
* To play with Python:
*** Install it on your machine or a public machine: [https://www.anaconda.com/download/ Download]
+
** Install it on your machine or a public machine: [https://www.anaconda.com/download/ Download]
*** Use a Duke container with Spyder: [https://vm-manage.oit.duke.edu/containers Containers] - note - these do not have access to your Duke files.  More on how to connect that later.
+
** Use a Duke container with Spyder: [https://vm-manage.oit.duke.edu/containers Containers] - note - these do not have access to your Duke files.  More on how to connect that later.
** Quick tour of Python
+
* Quick tour of Python
*** Editing window, variable explorer, and console
+
** Editing window, variable explorer, and console
*** Variable explorer is your friend  
+
** Variable explorer is your friend  
** From Dewey - programming language typically have ability to work with input, output, math, conditional execution, and repetition
+
* From Dewey - programming language typically have ability to work with input, output, math, conditional execution, and repetition
** Hilton and Bracy Seven Steps
+
* Hilton and Bracy Seven Steps
** Class work developing algorithm for program to determine if a number is prime
+
* Class work developing algorithm for program to determine if a number is prime
* Lecture 3  
+
=== Lecture 3 ===
** 7 Steps for finding prime numbers
+
* 7 Steps for finding prime numbers
** prime program -- includes intro to input(), if tree, for loop, print(), remainder %
+
* prime program -- includes intro to input(), if tree, for loop, print(), remainder %
* Lecture 4
+
=== Lecture 4===
** Function definitions
+
* Function definitions
*** Positional and key word arguments (kwargs)
+
** Positional and key word arguments (kwargs)
*** Default values
+
** Default values
*** Returns tuples -- can be received by a single item or a tuple of the right size
+
** Returns tuples -- can be received by a single item or a tuple of the right size
** Aquarium
+
* Aquarium
* Lecture 5
+
=== Lecture 5===
** print() and format specifications: [https://docs.python.org/3/library/string.html#formatspec link]
+
* print() and format specifications: [https://docs.python.org/3/library/string.html#formatspec link]
*** Main components are width, precision, and type; sometimes initial +
+
** Main components are width, precision, and type; sometimes initial +
*** e and f can print integers as floats; d '''cannot''' print floats
+
** e and f can print integers as floats; d '''cannot''' print floats
** relational and logical operators - how they work on item, string, list, tuple
+
* relational and logical operators - how they work on item, string, list, tuple
** if trees
+
* if trees
** while loops
+
* while loops
** for loops
+
* for loops
** counting characters program
+
** NOTE: in the case of
 +
for y in x
 +
:: If the ''entries'' of x are changed, or really if x is changed in a way that its location in memory remained '''unchanged,''' y will iterate over the changed entries.  If x is changed so that a copy first has to be made (for example, it is set equal to a slice of itself), then y will iterate over the original entries.  Note the differences between:
 +
<source lang=python>
 +
x = [1, 2, 3, 4, 5]
 +
for y in x:
 +
    print(x, y)
 +
    x[4] = [0]
 +
    print(x, y)
 +
</source>
 +
and:
 +
<source lang=python>
 +
x = [1, 2, 3, 4, 5]
 +
for y in x:
 +
    print(x, y)
 +
    x = x[:-1]
 +
    print(x, y)
 +
</source>
 +
 
 +
* counting characters program
 
<div class="mw-collapsible mw-collapsed">
 
<div class="mw-collapsible mw-collapsed">
 
<source lang=python>
 
<source lang=python>
Line 64: Line 83:
 
</div>
 
</div>
 
</div>
 
</div>
:* Question in class: does Python have ++ or -- operators; it does not.  You need x += 1 or x -= 1
+
* Question in class: does Python have ++ or -- operators; it does not.  You need x += 1 or x -= 1
  
 
== Labs ==
 
== Labs ==

Revision as of 01:27, 16 September 2018

This page will be used to keep track of the commands and major concepts for each lab in EGR 103.

Lectures

Lecture 1 - Introduction

  • Class web page: EGR 103L; assignments, contact info, readings, etc - see slides on Errata/Notes page
  • Sakai page: Sakai 103L page; grades, surveys and tests, some assignment submissions
  • Piazza page: Piazza 103L page; message board for questions

Lecture 2 - Programs and Programming

  • To play with Python:
    • Install it on your machine or a public machine: Download
    • Use a Duke container with Spyder: Containers - note - these do not have access to your Duke files. More on how to connect that later.
  • Quick tour of Python
    • Editing window, variable explorer, and console
    • Variable explorer is your friend
  • From Dewey - programming language typically have ability to work with input, output, math, conditional execution, and repetition
  • Hilton and Bracy Seven Steps
  • Class work developing algorithm for program to determine if a number is prime

Lecture 3

  • 7 Steps for finding prime numbers
  • prime program -- includes intro to input(), if tree, for loop, print(), remainder %

Lecture 4

  • Function definitions
    • Positional and key word arguments (kwargs)
    • Default values
    • Returns tuples -- can be received by a single item or a tuple of the right size
  • Aquarium

Lecture 5

  • print() and format specifications: link
    • Main components are width, precision, and type; sometimes initial +
    • e and f can print integers as floats; d cannot print floats
  • relational and logical operators - how they work on item, string, list, tuple
  • if trees
  • while loops
  • for loops
    • NOTE: in the case of
for y in x
If the entries of x are changed, or really if x is changed in a way that its location in memory remained unchanged, y will iterate over the changed entries. If x is changed so that a copy first has to be made (for example, it is set equal to a slice of itself), then y will iterate over the original entries. Note the differences between:
x = [1, 2, 3, 4, 5]
for y in x:
    print(x, y)
    x[4] = [0]
    print(x, y)

and:

x = [1, 2, 3, 4, 5]
for y in x:
    print(x, y)
    x = x[:-1]
    print(x, y)
  • counting characters program
# letter_typing.py from class:
def check_letters(phrase):
    vowels = "aeiou"
    numbers = "0123456789"
    consonants = "bcdfghjklmnpqrstvwxyz"
    # vowels, numbers, consonants, and other in that order
    count = [0, 0, 0, 0]
    
    for letter in phrase:
        if letter.lower() in vowels:
            count[0] += 1
        elif letter.lower() in numbers: # .lower not really needed here
            count[1] += 1
        elif letter.lower() in consonants:
            count[2] += 1
        else:
            count[3] += 1
            
    return count

out = check_letters("Let's go Duke University 2018!")
print(out)
  • Question in class: does Python have ++ or -- operators; it does not. You need x += 1 or x -= 1

Labs

  • Lab 1
    • Unix commands: pwd, cd, ls, mkdir, wget, tar, cp, latex, dvipdf, evince, xeyes
    • Other concepts: MobaXterm, XQuartz, ssh
    • Windows permissions were covered, but were only needed during this one lab.
    • Mounting CIFS drives was covered, but will not be needed for lab 1.
    • Three parts of lab:
      • Once only ever: creating EGR 103 folder, setting Windows permissions
      • Once per lab: creating lab1 folder, wget-ting files, tar expansion, duplicate lab skeleton
      • Doing work: changing to lab1 folder; using emacs, latex, dvipsd, and evince correctly
    • Work on lab every day - at least logging in, changing directories, using (emacs, latex, dvipdf, evince)
    • Work a little at a time to help with debugging