EGR 103/Concept List Fall 2019

From PrattWiki
Revision as of 20:58, 10 September 2018 by DukeEgr93 (talk | contribs)
Jump to navigation Jump to search

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
    • 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