id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

amgreyson@gmail.com > reflect
prev  |  next  |  chance

Given the vertices of a polygon and a string "X" or "Y" representing the axis, return the vertices of its reflection across the specified axis. Input L1 is the list of x-coordinates, and input L2 is the list of corresponding y-coordinates. Return the result as a list containing two items: the list of x-coordinates followed by the list of corresponding y-coordinates for the reflected polygon.


reflect([1, 3, 6], [5, 1, 2], 'X') → [[1, 3, 6], [-5, -1, -2]]
reflect([0, 7, 0], [0, 0, 7], 'Y') → [[0, -7, 0], [0, 0, 7]]
reflect([-1, -3, -6], [-5, -1, -2], 'Y') → [[1, 3, 6], [-5, -1, -2]]

...Save, Compile, Run (ctrl-enter)

def reflect(L1, L2, axis):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 150 Post-solution available

Copyright Nick Parlante 2017 - privacy