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
Rzqust [24]
2 years ago
7

Write a function named partfthat takes inas parameterstwo parallel lists: a list of times (in increasing order), and a list of d

istance traveled by that point in time. The function should return a new list giving the average velocity between consecutive time measurements. The new list should have a length of one less than the original lists.
Computers and Technology
1 answer:
mario62 [17]2 years ago
4 0

The program calculates the velocity between points in a list is written below. The program is written in python 3 thus ;

t = input("Enter time values : ")

<em>#Enter</em><em> </em><em>the</em><em> </em><em>time</em><em> </em><em>values</em><em> </em><em>of</em><em> </em><em>the</em><em> </em><em>data</em>

p = input("Enter distance values : ")

<em>#Enter</em><em> </em><em>the</em><em> </em><em>distance</em><em> </em><em>values</em>

dist = [float(x) for x in p.split()]

time = [float(x) for x in t.split()]

<em>#pyt</em><em> </em><em>then</em><em> </em><em>values</em><em> </em><em>in</em><em> </em><em>a</em><em> </em><em>list</em><em> </em>

def partfthat(dist, time):

<em>#initialize</em><em> </em><em>function</em><em> </em><em>that</em><em> </em><em>takes</em><em> </em><em>in</em><em> </em><em>two</em><em> </em><em>parameters</em><em> </em>

vel = []

<em>#empty</em><em> </em><em>list</em><em> </em><em>to</em><em> </em><em>hold</em><em> </em><em>the</em><em> </em><em>calculated</em><em> </em><em>velocity</em><em> </em><em>values</em><em> </em>

i = 0

<em>#indexer</em><em> </em>

while i <= len(dist)-2:

<em>#while</em><em> </em><em>loop</em><em> </em><em>to</em><em> </em><em>iterate</em><em> </em>

v = (dist[i+1] - dist[i]) / (time[i+1] -time[i])

<em>#</em><em>Use</em><em> </em><em>the</em><em> </em><em>velocity</em><em> </em><em>formula</em><em> </em>

vel.append(v)

<em>#append</em><em> </em><em>values</em><em> </em><em>to</em><em> </em><em>the</em><em> </em><em>empty list</em><em> </em><em>created</em><em> </em>

i+=1

return vel

print(avg_vel(dist, time))

<em>A</em><em> </em><em>sample</em><em> </em><em>run</em><em> </em><em>of</em><em> </em><em>the</em><em> </em><em>program</em><em> </em><em>is</em><em> </em><em>attached</em><em>.</em><em> </em>

Learn more : brainly.com/question/25681441

You might be interested in
A user informs you that he or she never deletes any files he or she creates. How might this affect the operating system? It will
Juliette [100K]

Answer:

Depending on the amount of files there are, the operating system will run slower because these files take up space on the hard drive, slowing it down.

Explanation:

6 0
2 years ago
Which header will be the largest?<br><br> Hello<br><br> Hello<br><br> Hello<br><br> Hello
geniusboy [140]

Answer:  

Bye

bye

bye

bye

Explanation:

4 0
3 years ago
Read 2 more answers
What it the total resistance in a series circuit with two resistors of 100 ohms each?
snow_tiger [21]

Answer:

200Ω

Explanation:

In series circuits, you add the resistances.

3 0
2 years ago
PLS HURRY!!!<br> Look at the image below!
max2010maxim [7]

Answer:

Ctrl+c

Explanation:

6 0
3 years ago
Read 2 more answers
Is number 1 correct​
Nutka1998 [239]

Answer:

Yes, number 1 is correct

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Write an exception class named InvalidTestScore. Modify the TestScores class you wrote in Part I so that it throws an InvalidTes
    10·1 answer
  • Write a Python program that will take as input 5 integer values and will output the average of the odd values and the average of
    6·1 answer
  • Computer user support helps people with minor computer problems. <br><br> True or False
    12·1 answer
  • Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative intege
    10·1 answer
  • Write a Java program in jGRASP that creates a 2D integer array of 5 rows and 20 columns, fills it with increasing integer values
    13·1 answer
  • Which of the following statements about the relationship between hardware and software is true? a) Hardware can be present in in
    9·1 answer
  • How do you check to see if the user entered more than one character? Complete the code.
    14·1 answer
  • What is the other name of iterative staatement ​
    13·1 answer
  • Diffreciate between primary source of information and secondary source of information​
    5·1 answer
  • Which of the following is not a component of Power BI?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!