vendredi 29 novembre 2019

How to move along a 2d grid in python?

Stumbled upon an interesting question which i'm not sure how to approach. I have to make a function which takes in a set of moves such as L = left, R = right and F = forward, and moves the point on the 2D grid which is sitting at (0,0) pointing up. For example, given the string 'RFLFR', (1,1) would be returned since it is sitting on that point on the grid now, pointing to the right.

Aucun commentaire:

Enregistrer un commentaire