New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Week 3 Notes

by: Eunice

Week 3 Notes CS 1110-002


Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Week 3!
Intro to Computing using Python
Lee, Van Loan
Class Notes
CS, Python
25 ?




Popular in Intro to Computing using Python

Popular in ComputerScienence

This 4 page Class Notes was uploaded by Eunice on Saturday February 13, 2016. The Class Notes belongs to CS 1110-002 at Cornell University taught by Lee, Van Loan in Spring 2016. Since its upload, it has received 23 views. For similar materials see Intro to Computing using Python in ComputerScienence at Cornell University.

Similar to CS 1110-002 at Cornell


Reviews for Week 3 Notes


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 02/13/16
CS 1110 Spring 2016 Lee and Van Loan February 9, 2016  3.  logical/Boolean operations o a Boolean expression can be stored in a variable (the result of the expression will be stored) x y x AND y true true true true false false false true false false false false x y x OR y true true true true false true false true true false false false  and: both statements must be true for the overall statement to be true o a<=x and x<=b o is the same as o a<=x<=b  or: at least one of the statements must be true for the overall statement to be true  not: o not true = false o not false = true  4. o function  implement a function: package a computational idea so that others can use it  m = fct(x,y)  fct: name given to a function  x, y: both are arguments o arguments may be expressions  python functions: max, min, abs, round o modules  common: math, string, random, numpy, scipy, timeit, urllib2, PIL (image processing), datetime  to get help:  >>> help (‘whatever I need help on’)  to access math module  >>> import math  >>> print math.sqrt(4)  2  this is dot notation o advantage being that if you are using multiple modules that each have functions with the same name, then dot notation clarifies  to access a function in the math module  >>> from math import sqrt  >>> print sqrt(4)  2  >>> from math import sqrt, pi, cos, log  [just give me what I need]  >>> from math import *  * imports all functions  functions: math.floor, math.ceil, math.round o building functions  >>> def function(argument): [header]  >>> body statement  >>> more body statements  >>> return a variable February 11, 2016  modules and functions o you can use a function without understanding how the function works o authors of a function must make available the how-to-use information through docstrings and comments o rule 1 and 2  module starts with authorship comments and an explanation  #module name  #author(s) names (and netid)  #last modified date  “””a doctstring: a module to ____””” o rule 3.  each function starts with a docstring “specification”  short summary that states what the function returns (post condition)  longer prose can be include which gives more useful info  precondition: conditions that the argument must satisfy if the function is to work o know how to  access functions: import  create functions: def  document functions: docstrings and comments  procedures o procedures are functions that do not return values, they “do something”  functions can call other functions o iterations, nesting, loops, random computations, recursion (will learn)  simple graphics: o makewindow  first: get a canvass  from simplegraphics import*  n=5  makewindow(n)  window now exists: -5<=x<=5 and -5<=y<=5  makewindow (n, bgcolor=PURPLE) o this is an optional argument o overrides the default of white  makewindow (n, bgcolor=ORANGE, labels=False) o disables axes’ labels o another optional argument o optional arguments don’t require a certain order, they’re like synonyms o module has data, 13 different colors o showwindow o drawrect  must tell the program:  the center of rectangle  horizontal dimension  vertical  optional  fill color o default is no color  width of perimeter  color of perimeter highlight  rotation angle (theta=degree)  x=0;y=0;L=5;W=3  Drawerct(x,y,L,W,fillcolor=magenta, edgewidth=6,theta=30)  showwindow() o drawdisk  must tell  center  radius  in order to get the row of diminishing circles (use iterations of a math function) o drawstar  also needs a center and radius o drawlineseg  need to define the start and end points  can define the color and width o drawtext  tell:  the location of text  the string  can tell: the color and size o drawTile  tell the center, the radius, three colors of 3 objects in the tile (x,y,r,c1,c2,c3)  color  set of three number between 0 and 1, number represent the amount of  [red, green, blue] a list of length three  an application script uses procedures and functions defined above


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Anthony Lee UC Santa Barbara

"I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.