100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Class notes

CSCA08 Lecture Notes (1-12) and PCRS Example Questions and Answers

Rating
-
Sold
1
Pages
9
Uploaded on
15-10-2021
Written in
2019/2020

CSCA08 Lecture Notes (1-12) and PCRS Example Questions and Answers

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
October 15, 2021
Number of pages
9
Written in
2019/2020
Type
Class notes
Professor(s)
Anya tafliovich
Contains
All classes

Subjects

Content preview

Lecture Jan 7, 2020
● Syllabus, PCRS, and general introductions
Lecture 02
● Terminology
○ 1+2
■ Operators = +
■ Operands = 1, 2
○ -3
■ Operator = -
■ Operand = 3
● Order of arithmetic precedence
○ ()
○ **
○ - (negative sign)
○ *, /, //, %
○ -, +
● Python documentation
○ Ex. round(number, ndigits=None)
■ Round = function
■ Number = first argument
■ Ndigits = second argument
■ = None
● If the second argument is provided, round will use the provided argument.
Otherwise, round will use the value None for the second argument
● Ex. round(42.54335, 2) = 42.54
● Ex. round(42.54335) = 43
● Ex. round(1234.5678, -2) = 1200.0
PCRS Jan 15, 2020
● Argument = values given
○ Ex. data = 3
data2 = 7.5
result = min(data, data2)
● Parameters = values not given
○ Ex. def f(data):
return data * 0.5
Lecture 03 Tues Jan 14, 2020
● Terminology
○ x=1
■ x has gets 1
■ x refers to the value of 1
■ x has a memory address of id1
■ memory address id1 is stored in variable
● Naming variables
○ Starts with a letter or underscore only
○ Contains only letters, digits, or underscores
○ Case sensitive
PCRS Weds Jan 15, 2020
● Function design recipe
○ Examples
○ Header

, ○ Description
○ Body
○ Test
Lecture 04 Thurs Jan 16, 2020
● Midterm expected for first week of february
● Worksheet “Function Design Recipe”
○ Strings always have quotes
○ print(‘yes \n no’)
yes
no
○ print(‘yes \’ no’)
■ yes ‘ no
○ repeat_word(‘smiles’, 0)
■ ‘’
Lecture 05 Tues Jan 21, 2020
● Python considers strings as values too, when it comes to strings
○ Dictionary order
■ ‘abs’ < ‘bsd’
True
■ ‘bs’ <= ‘asd’
False (python evaluates one character at a time, b with a, then s with s)
■ ‘B’ <= ‘a’
True (all lowercase letters come before all uppercase letters)
■ ‘’ < ‘b’
True (empty strings come before all lowercase and all uppercases)
● Priority
○ Arithmetic functions and amounts (greater, less than, etc.) are evaluated left to right
■ Ex. 1 + 1 == 2
True (better to write as (1 + 1) == 2)
● Boolean Operators
○ Priority = Not > Or > And (NOA)
○ And
■ True and True = True
■ T and F = F
■ F and F = F
■ F and T = F
○ Or
■ T or T = T
■ T or F = T
■ F or F = F
■ F or T = T
○ Not

○ Evaluating Left to Right
■ As long as there aren’t any syntax error, it can return an answer. If items are undefined
or don’t make sense, it does not evaluate
● Ex. True and not not not False or (1 + 3) >= Kaveh
True
● If statements
○ Only one “if” and “else”, and an unlimited amount of “elif” in the middle.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
StudentUofT UofT
Follow You need to be logged in order to follow users or courses
Sold
49
Member since
4 year
Number of followers
6
Documents
52
Last sold
1 month ago
UofT LifeSci and Bird Courses

5.0

4 reviews

5
4
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions