{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec-11-20 - Announcements One question did not get graded...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
11/20/2009 1 ECS 10 11/18 Announcements One question did not get graded on the Scantrons. So 55 was the max score. We will re-scan them next week to fix this, and I’ll update the scores on SmartSite. No lecture next Wds. I will be in lab hours and we’ll do a little review project. try-except convert = True try: float(x) except: convert = False if convert: # rest of program here conversionCheck.py This is how couldBeFloat() worked. Recall specifically: if cc.couldBeFloat(popStr): pop = float(popStr) else: print ‘Not a number!’ The expression cc.couldBeFloat(popStr) is a Boolean, True if conversion will work. Functions Today we look at how this bit of code got into a function that we can include in a module. Any program we write with functions could have been written without them. No new magic…. But - makes it easy to pass code around, extend the language. Also makes for neater programs. Parts of a Function We have used lots of functions. Example: x = int (53.66) Function "parts of speech": Function parts of speech : Float 53.66 is the argument Int 53 is the return value Let’s make a function.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}