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]
4 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]4 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
what are 3 things you would like to get out of an ethical engineering class? and why? about a page explanation would do fine.
poizon [28]

Answer:

I don't know

Explanation:

i don't know

8 0
3 years ago
Read 2 more answers
Draw a flowchart to represent the logic of a program that allows the user to enter values for the current year and the user’s bi
Digiron [165]

Answer:

Please, see the attachment.

Explanation:

First, we have to create two input boxes that allows the user to write the current year in one of them and his/her birth year in the another one. Also, we have to create a label that will show the result of the desired variable. We can write a message "Your age is:" and it will be attached to the result.

For the algorithm, let's call the variables as follows:

CY = Current Year

BY = Birth Year

X = Age of user

When the user inserts the current year and his/her birth year, the program will do the following operation:

X = CY - BY; this operation will give us the age of the user

After this the user will see something like "Your age is:" X.

3 0
3 years ago
Assume a function requires 20 lines of machine code and will be called 10 times in the main program. You can choose to implement
Volgvan

Answer:

"Macro Instruction"

Explanation:

A macro definition is a rule or pattern that specifies how a certain input sequence should be mapped to a replacement output sequence according to a defined procedure. The mapping process that instantiates a macro use into a specific sequence is known as macro expansion.

It is a series of commands and actions that can be stored and run whenever you need to perform the task. You can record or build a macro and then run it to automatically repeat that series of steps or actions.

7 0
3 years ago
A group of students launches a model rocket in the vertical direction. Based on tracking data, they determine that the altitude
Fofino [41]

Answer:

u = 260.22m/s

S_{max} = 1141.07ft

Explanation:

Given

S_0 = 89.6ft --- Initial altitude

S_{16.5} = 0ft -- Altitude after 16.5 seconds

a = -g = -32.2ft/s^2 --- Acceleration (It is negative because it is an upward movement i.e. against gravity)

Solving (a): Final Speed of the rocket

To do this, we make use of:

S = ut + \frac{1}{2}at^2

The final altitude after 16.5 seconds is represented as:

S_{16.5} = S_0 + ut + \frac{1}{2}at^2

Substitute the following values:

S_0 = 89.6ft       S_{16.5} = 0ft     a = -g = -32.2ft/s^2    and t = 16.5

So, we have:

0 = 89.6 + u * 16.5 - \frac{1}{2} * 32.2 * 16.5^2

0 = 89.6 + u * 16.5 - \frac{1}{2} * 8766.45

0 = 89.6 + 16.5u-  4383.225

Collect Like Terms

16.5u = -89.6 +4383.225

16.5u = 4293.625

Make u the subject

u = \frac{4293.625}{16.5}

u = 260.21969697

u = 260.22m/s

Solving (b): The maximum height attained

First, we calculate the time taken to attain the maximum height.

Using:

v=u  + at

At the maximum height:

v =0 --- The final velocity

u = 260.22m/s

a = -g = -32.2ft/s^2

So, we have:

0 = 260.22 - 32.2t

Collect Like Terms

32.2t = 260.22

Make t the subject

t = \frac{260.22}{ 32.2}

t = 8.08s

The maximum height is then calculated as:

S_{max} = S_0 + ut + \frac{1}{2}at^2

This gives:

S_{max} = 89.6 + 260.22 * 8.08 - \frac{1}{2} * 32.2 * 8.08^2

S_{max} = 89.6 + 260.22 * 8.08 - \frac{1}{2} * 2102.22

S_{max} = 89.6 + 260.22 * 8.08 - 1051.11

S_{max} = 1141.0676

S_{max} = 1141.07ft

Hence, the maximum height is 1141.07ft

8 0
3 years ago
Which of the following is NOT true concerning the color of minerals? A. Some minerals have a consistent color, but many have a r
mixer [17]

Answer:

Option D

A mineral’s color reflects the wavelengths of light that are absorbed by the mineral.

Explanation:

Color is one of the physical properties of minerals. Many minerals have a wide range of colors but there are some minerals with one consistent color and such minerals are referred as monochromatic minerals for example azurite. Normally, the streak color tends to be less variable than the color of the whole mineral and impurities or minor chemical components in a mineral react and often control the display color of resultant mineral. Option D is incorrect since mineral's color don't reflect wavelengths of light absorbed by such minerals.

5 0
3 years ago
Other questions:
  • A square steel bar has a length of 7.2 ft and a 2.5 in by 2.5 in cross section and is subjected to axial tension. The final leng
    14·1 answer
  • In an orthogonal cutting operation, the tool has a rake angle = 12°. The chip thickness before the cut = 0.32 mm and the cut yie
    5·1 answer
  • 2. Compare an object
    9·1 answer
  • Find two quotes from the text that relate to bravery of odssey. Cite the quote with the Book number and line number. Add two sen
    13·1 answer
  • Thermal energy is...
    15·2 answers
  • What energy type is represented in the picture?
    6·2 answers
  • Give me a smart goals to achieve ​
    5·2 answers
  • The annual average of solar photovoltaic energy in Phoenix is 6,720
    8·1 answer
  • If I have a scaffold that is 83' tall, and the base of my scaffold is 5' wide least base dimension, then I am allowed to space m
    13·1 answer
  • Phosphorus and nitrogen are included in which category of water pollutants?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!