挑战Python100题(3)

发布时间:2023年12月23日

100+ Python challenging programming exercises 3

Question 21

Question A robot moves in a plane starting from the original point (0,0). The robot can move toward UP, DOWN, LEFT and RIGHT with a given steps. The trace of robot movement is shown as the following: UP 5 DOWN 3 LEFT 3 RIGHT 2 ?- The numbers after the direction are steps. Please write a program to compute the distance from current position after a sequence of movement and original point. If the distance is a float, then just print the nearest integer. Example: If the following tuples are given as input to the program: UP 5 DOWN 3 LEFT 3 RIGHT 2 Then, the output of the program should be: 2

Hints: In case of input data being supplied to the question, it should be assumed to be a console input.

问题:机器人从原点(0,0)开始

文章来源:https://blog.csdn.net/boysoft2002/article/details/135164236
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。