1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
snow_tiger [21]
3 years ago
8

A certain robot can perform only 4 types of movement. It can move either up or down or left or right. These movements are repres

ented by ’U’, ’D’, ’L’, ’R’. Assume all these movements to be of unit distance. Write a function named theRoundTrip that takes all the movements the robot made in a day as input and output True of bool type if the robot returned to its starting position after its journey. Otherwise, return False. If the input is bad print the message "bad input".
Engineering
1 answer:
Olegator [25]3 years ago
8 0

Answer:

def theRoundTrip(movement):

   x=0

   y=0

   for i in movement:

       if i not in ["U","L","D","R"]:

           print("bad input")

           return

       if i=="U":

           y+=1

       if i=="L":

           x-=1

       if i=="D":

           y-=1

       if i=="R":

           x+=1

   return x==0 and y==0

You might be interested in
How do you identify all sensors, functions, and where we can use them?
Alex17521 [72]

Sensor/Detectors/Transducers are electrical, opto-electrical, or electronic devices composed of specialty electronics or otherwise sensitive materials, for determining if there is a presence of a particular entity or function. Many vehicles including cars, trains, buses etc. all use sensors to monitor oil temperature and pressure, throttle and steering systems and so many more aspects.

7 0
2 years ago
Write multiple if statements:
lora16 [44]
Zrizorzlzfxxxgoxxxxpgxtoxxxhxuxyf
3 0
3 years ago
1. True/False The Pressure Relief valve maintains the minimum pressure in the hydraulic circuit​
elena55 [62]
Yeah it’s true. Good luck!!
3 0
3 years ago
The period of an 800 hertz sine wave is
sukhopar [10]

Explanation:

White Board Activity: Practice: A sound has a frequency of 800 Hz. What is the period of the wave? The wave repeats 800 times in 1 second and the period of the function is 1/800 or 0.00125.

3 0
2 years ago
British standered institution
Scorpion4ik [409]

Answer:

The British Standards Institution, is the national standards body of the United Kingdom. BSI produces technical standards on a wide range of products and services and also supplies certification and standards-related services to businesses

6 0
3 years ago
Other questions:
  • Hot water at an average temperature of 88°C and an average velocity of 0.4 m/s is flowing through a 5-m section of a thin-walled
    5·1 answer
  • In the fluid-flow analogy for electrical circuits, what is analogous to a conductor?
    6·1 answer
  • Basic output with variables (Java) This zyLab activity is intended for students to prepare for a larger programming assignment.
    7·1 answer
  • An intranet is a restricted network that relies on Internet technologies to provide an Internet-like environment within the comp
    11·1 answer
  • If a signal is transmitted at a power of 250 mWatts (mW) and the noise in the channel is 10 uWatts (uW), if the signal BW is 20M
    13·1 answer
  • What engine does chrysler 300c have?​
    15·1 answer
  • New ventures that are based on strategic value, such as valuable technology, are attractive while those with low or no strategic
    12·2 answers
  • What is the minimum clamp time for gluing a panel?
    7·1 answer
  • The web page you created displays the time in the correct time zone for the user's location.
    14·1 answer
  • I’m in Sociology Class guys and I need help on this question!
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!