Question

IN PYTHON: Winner of the Chevy and Ford Racing Teams Scenario There are eight cars in...

IN PYTHON:

Winner of the Chevy and Ford Racing Teams

Scenario

There are eight cars in each team called Chevy and Ford. One car from each team races its opponent on the drag strip. Read in the racing times for the eight Chevy cars and then read in the times for the eight Ford cars. Store the times into lists or tuples called Chevy and Ford. Then list the winner of each pair, giving the number of seconds the winner won by. At the end declare which team won based on which team had the most wins. Below is a sample match.

This is sample data for you to use for testing:

The times for the Chevy cars: 5.4 7.2  4.0  9.1 5.8  3.9  6.2 8.1

The times for the corresponding Ford cars: 5.8  6.9 3.9  9.2  5.8 3.8  6.0  8.5

And the winners are:

Chevy by 0.4 sec

Ford by 0.3 sec

Ford by 0.1 sec

Chevy by 0.1 sec

Tie !

Ford by 0.1 sec

Ford by 0.2 sec

Chevy by 0.4 sec

And the winning team is: F O R D !

  • Accept the racing times for each of the Chevy cars.
  • Accept the racing times for each of the Ford cars.
  • Then declare the wining car for each race, giving the winning time in seconds.
  • If the times are identical, then declare the race was a tie.
  • Finally, declare which team won the match, assuming a tie is possible.
0 0
Add a comment Improve this question Transcribed image text
Answer #1
chevyTime=input('The times for the Chevy cars: ')
fordTime=input('The times for the corresponding Ford cars: ')
chevy=[float(i) for i in chevyTime.split()]
ford=[float(i) for i in fordTime.split()]
chevyWins=0
fordWins=0
print('And the winners are:')
for i in range(len(chevy)):
    if chevy[i]<ford[i]:
        print('Chevy by {:.1f} sec'.format(-chevy[i]+ford[i]))
        chevyWins+=1
    elif chevy[i]>ford[i]:
        print('Ford by {:.1f} sec'.format(-ford[i] + chevy[i]))
        fordWins += 1
    else:
        print('Tie !')
if fordWins==chevyWins:
    print('It was a T I E !')
else:
    print('And the winning team is: ',end='')
    if fordWins>chevyWins:
        print('F O R D !')
    else:
        print('C H E V Y !')

Add a comment
Know the answer?
Add Answer to:
IN PYTHON: Winner of the Chevy and Ford Racing Teams Scenario There are eight cars in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT