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
Ammonia contained in a piston-cylinder assembly, initially saturated vapor at 0o F, undergoes an isothermal process during which
Rudik [331]

ANSWERS:

-P_{2(a)} =15.6lbf/in^2\\-P_{2(b)} =30.146lbf/in^2\\ T_{2(a)} =0^oF\\T_{2(b)} =0^oF\\x_{2(b)} =49.87percent

Explanation:

Given:

Piston cylinder assembly which mean that the process is constant pressure process P=C.

<u>AMMONIA </u>

state(1)

saturated vapor x_{1} =1

The temperature T_{1} =0^0 F

Isothermal process  T=C

a)

-V_{2} =2V_{1} ( double)

b)

-V_{2} =.5V_{2} (reduced by half)

To find the final state by giving the quality in lbf/in we assume the friction is neglected and the system is in equilibrium.

state(1)

using PVT data for saturated ammonia

-P_{1} =30.416 lbf/in^2\\-v_{1} =v_{g} =9.11ft^3/lb

then the state exists in the supper heated region.

a) from standard data

-v_{1(a)} =2v_{1} =18.22ft^3/lb\\-T_{1} =0^oF

at\\P_{x} =14lbf/in^2\\-v_{x} =20.289 ft^3/kg

at\\P_{y} =16 lbf/in^2\\-v_{y} =17.701ft^3/kg

assume linear interpolation

\frac{P_{x}-P_{2(b)}  }{P_{x}- P_{y} } =\frac{v_{x}-v_{1(a)}  }{v_{x}-v_{y}  }

P_{1(b)}=P_{x} -(P_{x} -P_{y} )*\frac{v_{x}- v_{1(b)} }{v_{x}-v_{y}  }\\ \\P_{1(b)} =14-(14-16)*\frac{20.289-18.22}{20.289-17.701} =15.6lbf/in^2

b)

-v_{2(a)} =2v_{1} =4.555ft^3/lb\\v_{g}

from standard data

-v_{f} =0.02419ft^3/kg\\-v_{g} =9.11ft^3/kg\\v_{f}

then the state exist in the wet zone

-P_{s} =30.146lbf/in^2\\v_{2(a)} =v_{f} +x(v_{g} -v_{f} )

x=\frac{v_{2(a)-v_{f} } }{v_{g} -v_{f} } \\x=\frac{4.555-0.02419}{9.11-0.02419} =49.87%

3 0
3 years ago
When a person has the ability to move a vehicle, they have ____________________.
sergiy2304 [10]

(Energy ) i think .....

4 0
3 years ago
Describe how you could engineer the situation to produce even more friction and heat
lana66690 [7]
True the use many abstract power
6 0
2 years ago
Discuss typical advantages and disadvantages of an irrigation system?
trapecia [35]
Advantages include low costs and minimal labor.Water stays in the root zone, and foliage stays dry. Drawbacks to surface irrigation include potential overwatering and wasteful runoff.
4 0
2 years ago
Pouring molten aluminum into a mold and allowing it to cool forms?
neonofarm [45]

Answer:it forms a molten mold that makes it hard to be able to smash something into it then make something like a key

Explanation:

7 0
3 years ago
Other questions:
  • Why research and development in Maintenance Engineering?
    6·1 answer
  • Please describe a real situation in which you had to troubleshoot and fix the failure of a piece equipment/machine?
    5·1 answer
  • Working with which of these systems requires a technician that has been certified in an EPA-approved course?
    11·1 answer
  • Determine the Thevenin/Norton Equivalent Circuit with respect to the terminalsa,bas shown in the figure. (Here 1A is an independ
    11·1 answer
  • Which of the following is NOT true concerning the color of minerals? A. Some minerals have a consistent color, but many have a r
    13·1 answer
  • What is stress corrosion cracking?
    9·1 answer
  • A pool of contaminated water is lined with a 40 cm thick containment barrier. The contaminant in the pit has a concentration of
    11·1 answer
  • On the position time curve, if the slope of a tangent at a point is positive, that means:
    6·2 answers
  • . H<br> Kijwhayhwbbwyhwbwbwgwwgbwbwhwh
    6·2 answers
  • A gas turbine receives a mixture having the following molar analysis: 10% CO2, 19% H2O, 71% N2 at 720 K, 0.35 MPa and a volumetr
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!