ECS 32A

Introduction to Programming

University of California - Davis

Introduction to programming and problem solving in Python. Aimed primarily at non-major students.
Get Access

24HR Notes for ECS 32A

Available 24 hours after each lecture

Semesters

All ECS 32A Materials | Winter 2019

ECS 32A Lecture Notes - Winter 2019, Lecture 30 - Acronym
24HR
Premium

1. Short Answer a. What will the following Python script print? x = True y = True if x and not y: print(Hello) Elif not x: print(World) Else: print(Goodbye) Goodbye B. Circle true or false TF Scope Determines the part of t...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Study Guide - Winter 2019, Final - Allen & Unwin, 18 Months, Newline
24HR
Premium

University of California, Davis ECS 32A Introduction to Python Winter 2019 Final Prof: N. Hanford Exam Guide Topics Include Basics of Python Variables and Expressions Branching Loops Functions Strings Lists and Dictionarie...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 29 - Init
24HR
Premium

31319 Parameterized Constructors Recall that the function descriptor of function signature for the default constructor is as follows def __init__(self): As opposed to the default constructor, a parameterized constructor ha...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 28 - Object-Oriented Programming, Init
24HR
Premium

31119 Announcement Sign up to be a CS Tutor Must receive a B+ or better in the course you are tutoring for There will be a review session held for finals Fill out the survey for any specific topics you want to cover Object...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 27: Writing Files
24HR
Premium

3919 Writing to Files Recall that the syntax to open a file is the open() function and the .close() method By default this opens a file to read from, but what about opening a file to write to? with open(output_file.txt, w)...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 26 - Json
24HR
Premium

3619 Importing just one thing from a module The syntax to import just one name from a module is From module import name From math import factorial Name collisions might occur The dot notation prevents this math.factorial(*...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 25: Raising Exceptions
24HR
Premium

3419 Raising Exceptions with Information x = -1 if x<0 : Try: raise ValueError(Hello!) Except ValueError as e: print(e) Raising Exceptions within Functions The function will instantly terminate and return the exception to ...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 23: Try Catch Exception
24HR
Premium

22719 Nesting Dictionaries A nested dictionary is a simply a dictionary where the value to a key is another dictionary First we create the inner dictionary Student_info = {Name: Nate, Grade: 4.0} Next we create the outer d...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 22: Dictionaries
24HR
Premium

22519 Nested List Recap For row in mat: For item in row: print(item, end= ) print() Sorted lists with .sort() and sorted() sorted() returns a copy of the list sort() permanently changes the list Command Line Shell The shel...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 21: Lists
24HR
Premium

22219 Useful Method of List max(list) Gives the maximum value from a lis min(list) Gives the minimum value from a list sum(list) Gives the sum of a list of numerics Iterating over Lists A for loop allows you to visit each ...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 20 - Substring
24HR
Premium

22019 Method: Function that belongs to an object The string replace method By default, it replaces all occurrences of a substring with another substring Syntax: my_string.replace(old, new) We can also tell it to replace th...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 18: Keyword Arguments and String Formatting
24HR
Premium

21519 Function Arguments and Mutability Function arguments in Python are pass-by assignment When the function gets called, parameters are assigned to arguments Keyword Arguments and Named Parameters Explicitly tells the fu...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 17: Scope
24HR
Premium

21319 Important Info Midterm pushed back to march 1st When to use functions If the same code if being used more than twice, make it a function If there are a ton of arguments in the parameters, it may not be the best funct...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 16: Function Stubs
24HR
Premium

21119 Control Statement Review Pass statement just goes through the loop and does nothing If char.isdigit(): Pass If the condition is satisfied, and runs the pass statement which just continues on with the program For loop...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 15: Functions
24HR
Premium

Important Announcement Zylab deadline for 5.15 extended 5.14 is extra credit Functions Things lke print() input() str() are all functions which do certain tasks when called upon Python allows you to create your own functio...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 14 - Hhhh
24HR
Premium

2619 Tips for Zylab 5.14 Figure out your constants. Use a dictionary. Remember that both c and c should have the same molecular weight, so your dictionary might have 6 elements instead of 3. Have an outer while loop that c...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 13 - Late Fee
24HR
Premium

find more resources at oneclass.com 2/4/19 Counting iterations using a loop variable Using an integer i = 1 While i <= 5: input(Loop iteration # + str(i) + ...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 11: While Loops
24HR
Premium

1312019 Important Announcements Practice midterm on canvas Review session on canvas Code blocks and indentation Denotes ownership Indents are typically 4 spaces or press the tab key Caveat: Spanning Multiple Lines Each lin...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 10: Nested Loops and Boolean
24HR
Premium

12819 Nested if-else Basically just an if-else statement inside another if-else loop Lots of ways to use the if else logic If (condition): Do x if condition by itself if(condition): if -else logic Do x Else (condition): Do...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 9: Branches
24HR
Premium

12519 Practice Exam 1 is posted on Canvas Binary Numbers Computers store and calculate informatinon in binary numbers Humans use a base 10 system 1s place, 10s place, 100s place Binary has a base 2 system 1s place, 2s plac...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 8 - Round Number, Tuple
24HR
Premium

12319 Exam Info 40 minutes 1 cheat sheet allowed True-false, short answer, circle the right answer Dictionaries: Syntax Fruit = {} Fruit = {apple: 1.29, Orange: 0.79} Apple and Orange are keys 1.29 and 0.79 are values Ever...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 6: Strings and Lists
24HR
Premium

11819 Using the math module Import math math.sqrt(16) The math module has tons of useful math functions math.ceil(my_num) Representing Text Unicode table Letters are in decimal order from first to last, but uppercase comes...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture 5: Arithmetic Expressions
24HR
Premium

1162019 Arithmetic Expressions Expression: code that evaluates to a value Operators Addition : + Subtraction: - Multiplication: * Division: Exponent: ** Operator Precedence Parentheses Unary - (makes the value negative) *,...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 4 - Social Security Number, Takers
24HR
Premium

Important Information The Student Disability Center (SDC) asks that students interested in serving as paid note takers for this course please contact the Student Disability Center at sdc@ucdavis.edu. Note takers are paid a...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 3 - Kilobyte, 18 Months, Open-Source Software
24HR
Premium

Basic Computational Theory All arithmetic is reduced to mere counting Addition, subtraction, multiplication, and division Modern computers are based on voltage levels, either on or off The reason there are only two levels ...

Engineering: Computer Science
ECS 32A
tba
ECS 32A Lecture Notes - Winter 2019, Lecture 2 - Newline, Ascii Art
24HR
Premium

find more resources at oneclass.com 1/9/2019 Basic Input and Output Output is important bc it allows Python scripts to interact with other programs Python uses the print() function to print information ...

Engineering: Computer Science
ECS 32A
tba
Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit