CSC 226

CSC 226 logo

Software Design and Implementation


A7: Cityscape

Assignment A7 should be complete individually.
In this assignment, students will work more with functions, with a focus on the parameter passing, and we will use conditionals within functions


The instructions

This assignment must be completed individually, but consulting with each other is fine.
In this assignment, you will create one or more python functions and use them to create a cityscape or other landscape like a forest or mountain range or beach using turtle graphics. Note that you MAY build from previous work--just indicate you are doing so.

As always, be sure that you acknowledge via a reference any external ideas which are not your own.

Here is an example which uses conditionals to create houses with differing numbers of windows:
In general, you want a function's purpose to be for the creation of a *single* "thing" like a house or a star or a tree.

Create a new program called yourusername-a7.py. Make sure that your program:
  • Has three or more functions that you create (including main()).
  • At least one of your functions should be used for creating a drawing and should:
    • Have two or more input parameters (such a turtle, x-position, y-position, size color, etc)
  • All functions must:
    • Begin with a triple quoted docstring describing what arguments our function takes, what it does, and what the expected result is. It need not be long, but it should have enough info to be able to use the function without having to look at the code.
    • Be created for a *single* purpose. (like creating a house or a star or a tree or doing a single computation, etc.) The key word here is *single.*
  • Be sure to include amain()function.
  • The highest level of your program (i.e., no indenting) shouldonlycontain the following:
    • the header
    • any import statements
    • function definitions
    • a call to the main() function
  • At least one function is called multiple times with different parameters.
  • At least one function has parameter names which are not the same names as the variable names in the argument, so you can practice "parameter passing."
  • At least one function must use a conditional (if/elif/else or if/else) to do something meaningful in your image.
  • Make effective use of functions and to use docstrings to help clearly explain what each function is designed to do.
  • The program taken as a whole creates a coherent picture which is more than just a set of randomly drawn images.
  • The image drawn by the program has a background which is not white. It can be a color or an image.
  • The program uses creativity and has at least one interesting detail beyond that drawn by a single function.
  • Be sure to include our standard header at the top of your program with name, username, assignment number, purpose and acknowledgements.
  • Also, please be sure to include comments for the sections in your code which draws the different shapes.
Note that submitted files with incorrect filenames may not receive full credit because it makes grading more difficult for us and the TAs, so please check filenames carefully!


Copyright 2016 | http://cs.berea.edu/courses/CSC226/ | Licensed under a Creative Commons Attribution-Share Alike 3.0 United States License