what is the algorithm for this following code: # Display the…

Question Answered step-by-step what is the algorithm for this following code: # Display the… what is the algorithm for this following code:  # Display the options with charges to user for toll collectionprint(“Following are the options for cars and their respective toll:”)CarOptions =  { ‘Mini car’ : ‘AED 2’,          ‘Sedan car’: ‘AED 3’,          ‘SUV’ : ‘AED 4’,          ‘Truck/Bus/Coach’ : ‘AED 8’,          ‘Emergency vehicle’: ‘AED 0’,          ‘See result’: ‘ ‘,          ‘Exit program’: ‘ ‘}Carlist = [‘Mini car’, ‘Sedan car’, ‘SUV’, ‘Truck/Bus/Coach’, ‘Emergency vehicle’]for i, j in CarOptions.items():    print(i, “”, j)# Ask the user to enter the option number for the car passedexit_program = 7while True:    car_passed = int(input(“Please enter the option number for the car passed: “))    # If a user enter option 6 then the program will generate result    if car_passed == 6:        print(“Salik Collected Toll for Today”)        for i in Carlist:            total = {‘Mini car’: 0, ‘Sedan car’: 0, ‘SUV’: 0, ‘Truck/Bus/Coach’: 0, ‘Emergency Vehicle’: 0}            if total [i] > 0:                salik = str(total[i]) + ” ” + i + “s passed-” + str(total[i]) + “*” + CarOptions[i][-1] + “= ” + str(total[i] * int(CarOptions[i][-1])) + “AED Toll Collected”                print(salik)    if car_passed <= 5:       print(Carlist[car_passed - 1] + " passed and a toll of " + CarOptions[Carlist[car_passed - 1]] + " was collected")        # Ask the user to enter how many times did the option car passed        times_car_passed = int(input("please enter how many times " + Carlist[car_passed - 1] + " passed: "))        if Carlist[car_passed - 1] == 'Mini car':            result = times_car_passed * 2        elif Carlist[car_passed - 1] == 'Sedan Car':            result = times_car_passed * 3        elif Carlist[car_passed - 1] == 'SUV':            result = times_car_passed * 4        elif Carlist[car_passed - 1] == 'Truck/Bus/Coach':            result = times_car_passed * 8        elif Carlist[car_passed - 1] == 'Emergency vehicle':            result = times_car_passed * 0        iResult = ('Salik Collected Toll for Today: ' + str(result) + " AED")        print(iResult)    if car_passed == exit_program:        # In case option 7 is pressed then the program should write all details in a text file and stop execution        handle = open("CommonAssesment1.py", "w")        text = handle.writelines()        handle.close()        print(text)        break Computer Science Engineering & Technology Python Programming Share QuestionEmailCopy link Comments (0)