100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSCA08 Lecture Notes (1-12) and PCRS Example Questions and Answers CA$15.20   Add to cart

Class notes

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

 49 views  0 purchase

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

Preview 2 out of 9  pages

  • October 15, 2021
  • 9
  • 2019/2020
  • Class notes
  • Anya tafliovich
  • All classes
All documents for this subject (1)
avatar-seller
StudentUofT
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.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller StudentUofT. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for CA$15.20. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67866 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
CA$15.20
  • (0)
  Add to cart