given a list of vehicles and their owners, identify the newest vehicle owned by the owner of most vehicles as well as the total number of vehicles owned by that person

Respuesta :

The below code is done in the C language.

def doProject(input:list)->str:

   # declaring the datatypes

   carCount=dict()

   cars=dict()

   maxCars=0

   owner=""

   # itereating thorouh the list

   for i in input:

       words=i.split(',')

       carCount[words[2]]=carCount.get(words[2],0)+1

       cars[words[2]]=cars.get(words[2],[])

       cars[words[2]].append([words[0],int(words[1].split('/')[2])])

       if carCount[words[2]]>maxCars:

           owner=words[2]

           maxCars=carCount[words[2]]

           

   maxSpeed=0

   make=""

   

   # finding the latest model name

   car=cars[owner]

   year=0

   model=""

   for c in car:

       if c[1]>year:

           year=c[1]

           model=c[0]

   # setting the model speed and maker info

   if model=='Camry':

       maxSpeed=100

       make='Toyota'

   elif model=='Prius':

       maxSpeed=80

       make='Toyota'

   elif model=='Corvette':

       maxSpeed=160

       make='Chevrolet'

   elif model=='Challenger':

       maxSpeed=155

       make='Dodge'

   # returning the result of the program

   return f'{owner} has {maxCars} vehicles and is currently driving a {year} {make} {model} that goes {maxSpeed} mph.'

A general-purpose programming  C language for computers is called C (pronounced like the letter C) By design, C's features neatly reflect the CPUs it is intended to run on. Although its use in application software is waning, it continues to be useful in operating systems, device drivers, and protocol stacks. From the largest supercomputers to the smallest microcontrollers and embedded systems, C is frequently employed on different types of computer architectures.

Ritchie initially created C at Bell Labs between 1972 and 1973 to create tools that ran on Unix. It is the successor to the programming language B. The Unix operating system's kernel was re-implemented using it. [8] C increasingly grew in popularity throughout the 1980s. It has changed.

Learn more about  C language here:

https://brainly.com/question/5045657

#SPJ4

ACCESS MORE