Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getCorner(width, height):
- width = width
- height = height
- #YOUR CODE GOES HERE (indented)
- #define corners
- cor2 = 2
- cor3 = width - 1
- cor4 = width
- cor5 = width + 1
- cor6 = width * 2
- cor7 = width * (height - 2) + 1
- cor8 = width * (height - 1)
- cor9 = width * (height - 1) + 1
- cor10 = width * (height - 1) + 2
- cor11 = width * height - 1
- cor12 = width * height
- #compile string
- corners = "1"
- if width > 1:
- corners = corners + " " + "2"
- if width > 3:
- corners = corners + " " + str(cor3)
- if str(cor4) not in corners:
- corners = corners + " " + str(cor4)
- if height > 1:
- corners = corners + " " + str(cor5)
- if height > 2:
- if str(cor6) not in corners:
- corners = corners + " " + str(cor6)
- if height > 2:
- if str(cor7) not in corners:
- corners = corners + " " + str(cor7)
- if str(cor8) not in corners:
- corners = corners + " " + str(cor8)
- if str(cor9) not in corners:
- corners = corners + " " + str(cor9)
- if width > 1:
- if str(cor10) not in corners:
- corners = corners + " " + str(cor10)
- if width > 2:
- if str(cor11) not in corners:
- corners = corners + " " + str(cor11)
- if str(cor12) not in corners:
- corners = corners + " " + str(cor12)
- return corners
- #END YOUR CODE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement