Difference between revisions of "HTTLACS: Ch 3 Exercises"
From WLCS
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''Directions:''' | '''Directions:''' | ||
− | # Open a | + | # Open a new Google Drive document |
# Put your name at the top | # Put your name at the top | ||
− | # | + | # Title the document as YOURLASTNAME_ch3 |
− | # Complete the exercises below in this file. If you use | + | # Complete the exercises below in this file. If you use WingIDE, then be sure to copy & paste your code into the Google Doc |
# Be sure to number each of your answers!! | # Be sure to number each of your answers!! | ||
+ | |||
+ | '''References:''' | ||
+ | * [http://openbookproject.net/thinkcs/python/english2e/ch03.html How to Think Like a Computer Scientist: Chapter 3] | ||
'''Exercises:''' | '''Exercises:''' | ||
# Define the term: '''function definition''' | # Define the term: '''function definition''' | ||
− | # Where are '''all''' function definitions supposed to be placed? | + | # Where are '''all''' function definitions supposed to be placed? |
# Define the term: '''function header''' | # Define the term: '''function header''' | ||
# Define the term: '''function body''' | # Define the term: '''function body''' | ||
# What does a '''function call''' do? | # What does a '''function call''' do? | ||
− | # | + | # Define a function named '''new_line()''' that prints out an empty line. Test it out with a function call to new_line() |
+ | # Define a function named '''printHighFive()''' that prints out "High five!" 5 times. Test it out with a function call to printHighFive(). | ||
+ | # Define a function named '''print25High()''' that calls printHighFive() 5 times so that "High five" is shown 25 times. Test it out with a function call to print25High() | ||
+ | # Define the term: '''parameter''' | ||
+ | # What is the parameter in the following function header? '''def f(x):''' | ||
+ | # Complete the function body for '''def f(x):''' so that the cube of x is printed out (HINT: x to the power of 3) | ||
'''Submit:''' | '''Submit:''' | ||
− | * Submit | + | * Submit to Mr. Bui via [http://classroom.google.com Google Classroom] |
Latest revision as of 13:21, 1 October 2014
Directions:
- Open a new Google Drive document
- Put your name at the top
- Title the document as YOURLASTNAME_ch3
- Complete the exercises below in this file. If you use WingIDE, then be sure to copy & paste your code into the Google Doc
- Be sure to number each of your answers!!
References:
Exercises:
- Define the term: function definition
- Where are all function definitions supposed to be placed?
- Define the term: function header
- Define the term: function body
- What does a function call do?
- Define a function named new_line() that prints out an empty line. Test it out with a function call to new_line()
- Define a function named printHighFive() that prints out "High five!" 5 times. Test it out with a function call to printHighFive().
- Define a function named print25High() that calls printHighFive() 5 times so that "High five" is shown 25 times. Test it out with a function call to print25High()
- Define the term: parameter
- What is the parameter in the following function header? def f(x):
- Complete the function body for def f(x): so that the cube of x is printed out (HINT: x to the power of 3)
Submit:
- Submit to Mr. Bui via Google Classroom