CSC111 Lab 9 2011
--D. Thiebaut 13:15, 2 November 2011 (EDT)
Working with Functions
- For this part, work in Idle or emacs and create the various functions this lab presents you, and test them in main().
- For example, if you are asked to write a function that receives a string as parameter and prints it with a box around it, you could write something like this:
def boxIt( string ):
noChars = len( s )
print( "*" * ( noChars + 2 + 2 ) )
print( "| %s |" % string )
print( "*" * ( noChars + 2 + 2 ) )
def main():
boxIt( "hello!" )
boxIt( "This is a very long string!" )
boxIt( "" ) # empty string
main()
- No need to add documentation for the code in this lab (or just in spots where you think you need to add markers for yourself)