Difference between revisions of "HTTLACS: Ch 3 Exercises"
From WLCS
Line 5: | Line 5: | ||
# Complete the exercises below in this file. If you use DrPython, then be sure to copy your code back into this file | # Complete the exercises below in this file. If you use DrPython, then be sure to copy your code back into this file | ||
# Be sure to number each of your answers!! | # Be sure to number each of your answers!! | ||
+ | |||
+ | '''References:''' | ||
+ | * [http://openbookproject.net/thinkcs/python/english2e/ch01.html How to Think Like a Computer Scientist: Chapter 3] | ||
'''Exercises:''' | '''Exercises:''' |
Revision as of 08:50, 12 October 2010
Directions:
- Open a text editor (Applications->Accessories->gEdit Text Editor)
- Put your name at the top
- Save the file as YOURLASTNAME_ch3.txt
- Complete the exercises below in this file. If you use DrPython, then be sure to copy your code back into this file
- Be sure to number each of your answers!!
References:
Exercises:
- Define the term: function definition
- Where are all function definitions supposed to be placed? (HINT: It's like GvR)
- Define the term: function header
- Define the term: function body
- What does a function call do?
- Write a function named new_line() that prints out an empty line. Test it out with a function call.
- In the same program, write a function named three_lines() that calls new_line() and prints 3 blank lines. (HINT: new_line() should only be called 3 times)
- In the same program, write a function named nine_lines() that calls three_lines() and prints 9 blank lines. (HINT: three_lines() should only be called 3 times)
- In the same program, write a function named clear_screen() that calls a combination of nine_lines(), three_lines(), and new_line() to print out 25 blanks lines
Submit:
- Submit the file to School Web Lockers