rec2_Jan19

# rec2_Jan19 - Workshop 2 Fruitful vs Nonfruitful Parts of a...

This preview shows pages 1–7. Sign up to view the full content.

Workshop 2 January 19, 2012

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

View Full Document
Summary of Workshop - Fruitful vs. Nonfruitful - Parts of a Function (def line, colons, spacing, print vs return) - screenshot activity - Troubleshooting Common Errors Activity - Booleans ( and/or) - Simple Conditional Practice (if,elif, else) - Discuss Piazza & Advice Document - Ask your question on Piazza - If time allows: Quick For Loop Intro
Notes for students -Resubmission for hw00 is due January 20th (Friday) at 8pm. -Note that this resubmission will only be for THIS assignment. Do not expect this "safety net" for every mini project and homework assignment. -Mini Project 1 (MP1) is due January 25th (Wed) at 8pm -Jan 27: First QUIZ (Guide is posted)

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

View Full Document
Fruitful vs. Non-fruitful Fruitful- the function returns a value that can be saved and used for something else. Non-fruitful- a function that does what it is supposed to do (print a value, show a picture, etc.) but does not give you anything in return. Throughout this workshop, we will determine if any of the functions we come across are fruitful or non-fruitful.
Parts of a Function Syntax requirements: -Must use the "def" keyword to introduce a function. - a colon, ":", is used at the end of the function line. example: def myAwesomeFunction(parameter1): - indentation -print vs. return (can use Fruitful WS)

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

View Full Document
Parts of a Function- Activity 1. What is the name of the function shown above? 2. What are the keywords in the function 3. What are the parameters given in the function? 4. What is the result being returned? 5. True/False: Indentations don't matter in JES; they're only used to make the code look neat. 6. Label the code block in the function. 7. How many variable assignments are there? What are they?
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/06/2012 for the course COMPUTERSC 1315 taught by Professor Potts during the Spring '11 term at Harvard.

### Page1 / 17

rec2_Jan19 - Workshop 2 Fruitful vs Nonfruitful Parts of a...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online