Find the robot to charge

charging robot
volkswagen charging robot

There is a robot which wants to go the charging point to charge itself. The robot moves in a 2-D plane from the original point (0,0). The robot can move toward UP, DOWN, LEFT and RIGHT with given steps. The trace of robot movement is shown as the following:

UP 5
DOWN 3
LEFT 3
RIGHT 2

Then, the output of the program should be: 2

My code is

pos = {
    "x": 0, 
    "y": 0
}

while True:

    n = input()
    if not n:
        break

    direction,steps=n.split()
    if direction == "UP":
        pos["y"] += int(steps)
    elif direction == "DOWN":
        pos["y"] -= int(steps)
    elif direction == "LEFT":
        pos["x"] -= int(steps)
    elif direction == "RIGHT":
        pos["x"] += int(steps)
print (int(round((pos["x"]**2 + pos["y"]**2)**0.5)))

I am getting an error ValueError: not enough values to unpack (expected 2, got 1)


import math

pos=[0,0]

moves={"UP":[0,1],
       "DOWN":[0,-1],
       "LEFT":[-1,0],
       "RIGHT":[1,0]}

 data = list()
Set inputs
 num = int(input())

 for i in range(int(num)):

    n = input()
    data.append(n)
Move robot on valid moves
for inp in data:

    parts=inp.split()    
    mv=parts[0]
    val=parts[1]
    if mv in moves and val.isnumeric():
        pos[0] += moves[mv][0]*int(val)
        pos[1] += moves[mv][1]*int(val)
get distance
distance=math.sqrt(pos[0]**2 + pos[1]**2)

print(round(distance))

VW's prototype charging robot can find your EV in the parking , Tesla isn't the only car maker with grand visions of EV charging robots. Volkswagen has created a prototype charging robot that would navigate  First, press the Play/Pause button on the remote, then you can press the charge/home button. You will notice the DEEBOT will stop vacuuming and will head back to the charging dock. While your Deebot may take several minutes to find its charging station, it will eventually find it.


pos = {
    "x": 0, 
    "y": 0
}
z=int(input())
c=0
while (c!=z):

    n = input()
    c=c+1
    if not n:
        break

    direction,steps=n.split()
    if direction == "UP":
        pos["y"] += int(steps)
    elif direction == "DOWN":
        pos["y"] -= int(steps)
    elif direction == "LEFT":
        pos["x"] -= int(steps)
    elif direction == "RIGHT":
        pos["x"] += int(steps)
print (int(round((pos["x"]**2 + pos["y"]**2)**0.5)))

Find the robot to charge, import math pos=[0,0] moves={"UP":[0,1], "DOWN":[0,-1], "LEFT":[-1,0], "RIGHT":[1,​0]} data = list(). Set inputs. num = int(input()) for i in  To manually charge the POWERbot, lift up the POWERbot and then place it on the charger. Make sure that the charging pins on the POWERbot and charger are aligned and then press the Start button for about 3 seconds. The docking station is located in a corner where the POWERbot will have difficulty docking.


I got an alternate solution:

pos = {"x":0,"y":0}
num = int(input())

for _ in range (num):
    command =  input().split(" ")      # ACCEPT MOVEMENT COMMAND AND STORE AS A LIST
    if command[0] == "UP":             # EXTRACT DIRECTION AND COMPARE
        pos["y"] += int(command[1])    # INCREMENT/DECREMENT APPROPRIATE CO-ORDINATES
    if command[0] == "DOWN":
        pos["y"] -= int(command[1])
    if command[0] == "LEFT":
        pos["x"] -= int(command[1])
    if command[0] == "RIGHT":
        pos["x"] += int(command[1])

print(int(round((pos["x"]**2 + pos["y"]**2)**0.5)))   # DISTANCE FROM ORIGIN

maybe this is easier to understand.

Volkswagen wants robots to find your EV and charge it , VW said the machine leaves the charging device with the EV and the robot heads out to find other cars that need juicing. The totally autonomous  When you plug the Home Base® into a power source, its power indicator light will blink green for few seconds to indicate it is powered on, then the green light will go off while the robot continues to charge. This occurs with robots and Home Base® equipped with an energy-conserving feature. If your robot returns to the Home Base® and is unable to dock, it will try again until it docks successfully. When your robot makes a connection and docks successfully, the Home Base® power light


Volkswagen built a robot that can find your electric car in a parking , Volkswagen's prototype robotic charger can find an electric car that needs charging and charge it autonomously. The LiPo battery in your EZ-Robot must be fully charged before using. This will ensure a proper synchronization between the LiPo battery and charging unit. Not charging LiPo batteries before using is detrimental to the longevity of LiPo batteries.


How do I know if my Roomba® is charging?, If you see lights going off after a few seconds on your robot or Home Base when beginning to charge, know that your Home Base and the robot are equipped  Flip the robot over and remove the caster wheel. Ensure there is no built up debris in the caster wheel as this can cause the robot to not reach the charging contacts to charge. If debris found please perform caster wheel maintenance Place Roomba® on the Home Base®, and charge Roomba® for at least a ½ hour. Sincere!


Battery Level Indicator in the iRobot Home App., Get help with iRobot Customer Care and Technical Support. If the charging contacts on the robot are not making contact to the charging contacts on the Home  You can also give him a Voice Command to go charge, “Hey Vector [wait] Go home!” If you see this icon on his screen when Vector is off his charger, his battery is too low to operate. In this case, you will need to place him on his charger