Create a python program for Best Cars Company to calculate the government taxes and insurance amount for used cars. • You must use a loop to repeat the entire process for any 3 customers and cars. • Prompt the user to: “Press 1 to continue :”. If the input is equal to 1, program has to continue. For any other input, the program must terminate the execution. • Read the customer_id, customer_name, mobile, car_name, car_model, car_price from the user • Write a user defined function named caltax, to calculate tax and return all taxes as follows, • Parameters to this function are car_model and car_price • Calculate 0.05% of car_price as sales_tax • Calculate 0.36% of car_price as value_tax • Write a user defined function named calinsured to calculate and return the insured_value as follows, • Parameters to this function are car_name, car_model and car_price • If car_name is “toyota” and car_model is 2015, then insured_value is calculated as 33% of car_price • If car_name is “nissan” and car_model is 2017, then insured_value is calculated as 45% of car_price • For any other input , make insured_value as 0 and print the message “Not a valid input” • Print the output as shown below,
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images