def max(num_1, num_2):
'(int, int) -> int
outputs the maximumof the two given numbers
>max(10, 20)
20
>max(20,10)
20
'
#tells which one is the maximum number
max_number = (num_1 + num_2 + abs(num_1 -
def get_year(): #parameter = ;
'() should be interger
this function reads a year and return it
REQ(Requirement): 0<=year<=9999
> input a year :
2016
> input a year
2017
'
#get a year and return it
ye
Introduc)on to Proofs
September 6 & 8
Proofs
What propor)on of the rectangle does the triangle cover?
Proofs
What propor)on of the rectangle does the triangle cover?
play = open('play.txt', 'r')
def read_lines(play, character):
result = []
line = play.readline().strip()
while line:
if line[1: len(character) +1] = character:
res = line.strip('[' + character + ']').
def is_leap_year(year):
' (int) -> bool
Return True iff the year is a leap year.
Leap years are years with 366 days, which occur once every 4 years
(starting with year 4). Years that are divisible by
class Buyer():
' A class representing a buyer of a car'
def _init_(self, name, address, phone):
'(str, str, str) -> NoneType
sets up a new buyer by its name, address and phone
'
self._name = name
self
temp = [' ']
for i in range(10):
options = []
for j in temp:
if j.count('x') < 6:
options.append(j + 'x')
if j.count('y') < 4:
options.append(j + 'y')
temp = options
print(options)
print(len(options)
Catching Exceptions
Runtime Error
o Prevent you from using feature
o Lose information in file working on
o Causes errors in file
exception an error that occurs at runtime
Exception object (3 separa
CSCA48, Assignment #1-2
Calendar Implemetation
due 11:55pm July 17, 2016
Introduction
We are now fast-forwarding in time several steps after you presented your designs from
phase 1 to the client. A fe
CSCA48, Assignment #1-1
Design of Matrix Class Hierarchy
due 11:55pm June 19, 2016
Introduction
In this assignment you will design and then implement a Calendar ADT. In this rst phase,
you must design
find more resources at oneclass.com
CSCA48 Complexity:
March 16, 2017
The (worst case time) complexity of an algorithm is a function that maps from input sizes (i.e
Z^>=0) to running times (Z^+ = posi
University of Toronto at Scarborough
CSCA67 / MATA67Discrete Mathematics, Fall 2017
Assignment #2: Counting / Probability
Due: December 4, 2017 at 11:59 p.m.
This assignment is worth 10% of your final
University of Toronto at Scarborough
CSCA67 / MATA67Discrete Mathematics, Fall 2017
Exercise #7: Arrangement with Repetition
Due: November 19, 2017 at 11:59 p.m.
This assignment is worth 3% of your fi
University of Toronto at Scarborough
CSCA67 / MATA67Discrete Mathematics, Fall 2017
Exercise #8: Distributing Objects / Probability
Due: November 26, 2017 at 11:59 p.m.
This assignment is worth 3% of
Admin
Boolean Logic
Documentation
Design Recipe
Break
Design Steps
CSCA08 FALL 2017
W EEK 3 - D OCUMENTATION AND D ESIGN
Brian Harrington & Marzieh Ahmadzadeh
University of Toronto Scarborough
Septemb