Difference between revisions of "CSC111 Lab7 Solution Programs 2011"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- <onlydft> <source lang="python"> from graphics import * import time def ifStatement1(): print( "Please enter 2 numbers:" ) x = eval( input( "> " ) ) y = e...")
 
Line 9: Line 9:
  
 
def ifStatement1():
 
def ifStatement1():
 +
  """contains several if statements"""
 +
 +
  # test for zero divisor
 
   print( "Please enter 2 numbers:" )
 
   print( "Please enter 2 numbers:" )
 
   x = eval( input( "> " ) )
 
   x = eval( input( "> " ) )
Line 40: Line 43:
  
 
def ball():
 
def ball():
 +
    """moves a ball around the graphics window and make it bounce off
 +
    the sides.  The ball changes color as it crosses the middle of the graphics
 +
    window (horizontally), and bounces off the walls when its side hits the walls.
 +
    """
 +
 
     w = 400
 
     w = 400
 
     h = 400
 
     h = 400

Revision as of 13:00, 19 October 2011

--D. Thiebaut 13:58, 19 October 2011 (EDT)



...