Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Your name:
- # Your username:
- # CS111 PS03 Task 1
- # diamonds.py
- # Submission date:
- #******************************************************************************
- # Pre-defined strings. You're not allowed to create any other new strings
- # with quotes in this program!
- zeroStar = ' '
- oneStar = ' * '
- twoStar = ' * * '
- threeStar = '* * *'
- empty = ''
- #******************************************************************************
- # Define your functions (diamondPattern and other necessary helper
- # functions) below
- # Be sure to use meaningful function names, parameter names, and
- # variable names.
- # Comment your code appropriately
- # In particular, every function definition should have a
- # triple-quoted docstring between the header and the body
- # that briefly explains what the function does.
- #******************************************************************************
- # Testing block. Put all testing code indented inside this if block
- # Uncomment existing calls inside this testing block to run them
- # when you press the green run function in Canopy.
- if __name__ == "__main__":
- '''All your testing code should go below.
- Uncomment and comment particular lines as appropriate.'''
- #diamondPattern()
- def oneStar_():
- print (oneStar + zeroStar + oneStar + zeroStar + oneStar + zeroStar + oneStar)
- return empty
- def twoStar_():
- print (twoStar + zeroStar + twoStar + zeroStar + twoStar + zeroStar + twoStar)
- return empty
- def threeStar_():
- print (threeStar + zeroStar + threeStar + zeroStar + threeStar + zeroStar + threeStar)
- return empty
- def oneStar_stag():
- print (zeroStar, oneStar + zeroStar + oneStar + zeroStar + oneStar + zeroStar + oneStar)
- return empty
- def twoStar_stag():
- print (zeroStar, twoStar + zeroStar + twoStar + zeroStar + twoStar + zeroStar + twoStar)
- return empty
- def threeStar_stag():
- print (zeroStar, threeStar + zeroStar + threeStar + zeroStar + threeStar + zeroStar + threeStar)
- return empty
- def diamondNorm():
- return oneStar_(), twoStar_(), threeStar_(), twoStar_(), oneStar_()
- def diamondStag():
- return oneStar_stag(), twoStar_stag(), threeStar_stag(), twoStar_stag(), oneStar_stag()
- diamondNorm()
- diamondStag()
- diamondNorm()
- diamondStag()
- diamondNorm()
- diamondStag()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement