Question

In: Computer Science

python Create a new file name condition_quiz.py. Add a comment with your name and the date....

python

  1. Create a new file name condition_quiz.py.

  2. Add a comment with your name and the date.

  3. Prompt the user to enter the cost. Convert the input to a float.

  4. Prompt the user for a status. Convert the status to an integer

  5. Compute the special_fee based on the status.

If the status is 0, the special_fee will be 0.03 of the cost.

Else if the status is 1, the special_fee will be 0.04 of the cost.

Else if the status is 2, the special_fee will be 0.06 of the cost.

Else if the status is 3 or 4, the special_fee, the discount will be 0.07 of the cost.

Otherwise, the special_fee will be 0.10 of the cost.

  1. Compute the total_cost as the cost plus the special_fee. Print out the total_cost with two decimal places of precision.

Solutions

Expert Solution

code :

output :

raw_code :

#taking inputs
cost = float(input('Enter the cost : '))
status = int(input('Enter the status :'))

#checking for given conditions
if(status==0):
special_fee = 0.03*cost
elif(status==1):
special_fee = 0.04*cost
elif(status==2):
special_fee = 0.06*cost
elif(status == 3 or status==4):
special_fee = -0.07*cost
else:
special_fee = 0.10*cost

#printing total cost
total_cost = cost + special_fee
print('Total cost is {:.2f}'.format(total_cost))

***do comment for queries and rate me up****


Related Solutions

Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is 2,...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create a variable named base_fee and set the value to 5.5. Prompt the user for the zone. The zones can be an integer value from 1 to any value for the zone. Convert the zone to an integer. Display the zone on the SenseHat with a scroll speed of 0.3, make the text blue, and the background yellow. Scroll "The zone is " and the...
2. Add a title comment block to the top of the new Python file using the...
2. Add a title comment block to the top of the new Python file using the following form # A brief description of the project 3. Ask user - to enter the charge for food 4. Ask user - to enter theTip for server ( remember this is a percentage , the input therefore should be decimal. For example, for a 15% tip, 0.15 should be entered) 5. Ask user - to enter the Tax amount ( this is a...
Create a new Python 3 Jupyter Notebook. At the top, be sure to name your notebook...
Create a new Python 3 Jupyter Notebook. At the top, be sure to name your notebook as "*assignment 2.08 - Your Name Here.ipynb*" (obviously, replace the "Your Name Here" part with your actual name). Create a single python cell to program the following specifications. Use what you've learned on this page to: 1. Find the index of "lmno" in the English alphabet using an appropriate instruction and store it in a variable. (hint: you'll need to define a string that...
PYTHON. Tasks: Create and test the openFileReadRobust() function to open file (for reading) whose name is...
PYTHON. Tasks: Create and test the openFileReadRobust() function to open file (for reading) whose name is provided from the standard input (keyboard) – the name is requested until it is correct Create and test the openFileWriteRobust () function to open file (for writing) whose name is provided from the standard input (keyboard) – the name is requested until is correct Extend the program to count number of characters, words and lines in a file as discussed in the classby including...
Submit: One python file __name__ == "__main__" Screenshot of sample output Be sure to: Comment your...
Submit: One python file __name__ == "__main__" Screenshot of sample output Be sure to: Comment your code, classes and functions! Practice practice practice! Use meaningful variables If you do not I will remove points Dog Walker Program Create a program for a Dog Walking company to keep track of its employees, customers, and customer dogs You will need the following classes: Person With the following attributes: name id_number dogs : list of Dog objects With the appropriate setters and getters...
Write a Python program to (a) create a new empty stack. Then, (b) add items onto...
Write a Python program to (a) create a new empty stack. Then, (b) add items onto the stack. (c) Print the stack contents. (d) Remove an item off the stack, and (e) print the removed item. At the end, (f) print the new stack contents:
Name your program file warmup.py Submit your working Python code to your CodePost.io account. In this...
Name your program file warmup.py Submit your working Python code to your CodePost.io account. In this challenge, establish if a given integer num is a Curzon number. If 1 plus 2 elevated to num is exactly divisible by 1 plus 2 multiplied by num, then num is a Curzon number. Given a non-negative integer num, implement a function that returns True if num is a Curzon number, or False otherwise. Examples is_curzon(5) ➞ True 2 ** 5 + 1 =...
Create a Python program file and . Your program will draw random circles with filled and...
Create a Python program file and . Your program will draw random circles with filled and non-filled color (random colors) and rectangles, fill andnon-fill color (also random colors) on the canvas. At least 10 for each category
HW_6a - Read a text file Create a new C++ project and name it as:   Numbers...
HW_6a - Read a text file Create a new C++ project and name it as:   Numbers Create a text file and     save it as:   data.txt Create and save the file      in a C++ project      in the Resource folder. Enter the following numbers:        3                                                              4                                                              5       Note:   After you enter the 5, don’t press the enter key. Save and close the file. Add another file and name it:   Source.cpp Write one statement that declares a file...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT