Calculate and display the energy charge

Assignment Help Python Programming
Reference no: EM132356167

Question

The energy company uses different rates for residential and business customers. Residential customers pay $0.12 per kWh for the first 500 kWh. After the first 500 kWh, the rate is $0.15 per kWh. Business customers pay $0.16 per kWh for the first 800 kWh. After the first 800 kWh, the rate is $0.20 per kWh. Put together a program to calculate energy charge. Include the following two functions:

(a) A main function: Ask the user to enter number of kWh used and customer type (enter R for residential or B for business). Call the bill_calculator function and pass number of kWh used and customer type to it as arguments. You must use positional arguments to pass kWh used and customer type.

(b) A bill_calculator function: This function has two parameters to receive number of kWh used and customer type. Calculate and display the energy charge.

The following is an example.

Enter kilowatt hours used: 810

Enter R for residential customer, B for business customer: R

Please pay this amount: 106.5

The following is another example.

Enter kilowatt hours used: 810

Enter R for residential customer, B for business customer: b

Please pay this amount: 130.0

Second part, use keyword arguments to pass number of kWh and customer type to the bill_calculator function when it is called.

Reference no: EM132356167

Questions Cloud

Develop python code that implements the program requirements : Need a loop that prompts the user for an income, looks up the tax rate from the dictionary, and prints the income, tax rate, and tax.
Has anything in your autobiography changed : Explain any insights you had or conclusions you have drawn as a result of studying ethics as an I/O psychologist-in-training. Has anything in your autobiography
Capital budgeting techniques in your personal finances : How can you utilize capital budgeting techniques in your personal finances to determine whether an investment is a good idea?
Develop python application that incorporates using data type : Develop a Python application that incorporates using appropriate data types and provides program output in a logical manner.
Calculate and display the energy charge : The energy company uses different rates for residential and business customers. Residential customers pay $0.12 per kWh for the first 500 kWh.
What the implications of social change might be : Write a 1- to 2-paragraph analysis of your categorical data results for each research scenario. In your analysis, display the data for the output.
Calculate the simple payback period for this project : Calculate the simple payback period for this project. Your desired payback period is 5 years. How long is the payback period for this project?
Compare the old score and new score of each student : Compare the old score and new score of each student. If the old score and new score are different, display the two scores.
Identify and state the functional dependencies in the table : EEC 220CT Environment and Computing Assignment - Data and Information Retrieval. Identify and state the functional dependencies in the table

Reviews

Write a Review

Python Programming Questions & Answers

  Creating an application that simulate simple money manager

ITECH1400 – Foundations of Programming - Federation university Australia - creating an application that uses a GUI that simulates a simple money manager.

  How to design and implement a program

How to design and implement a program that prompts the user for numbers. The program should continue prompting for values until the user enters.

  Write a python script that counts occurrences of words

Write a python script that counts occurrences of words in a file. The script expects two command-line arguments: the name of an input file and a threshold.

  What is the difference between a for loop and a while loop

Explain how to use built-in functions, functions from module, and user-defined functions. What is the difference between a for loop and a while loop? What is the difference between elif and if-else?

  Create a python program that accepts two integer numbers

Create a Python program that accepts two integer numbers as input from the user. The program should then add the two numbers and print the sum as output.

  Describe an application you would like to be able to develop

Describe an application/program you would like to be able to develop. Think about a problem you would like to be able to solve or perhaps something.

  Write an algorithm for pseudo random number generator

Question - Write an algorithm for pseudo random number generator

  Assume that the variables gpa , deanslist and studentname

Assume that the variables gpa , deansList and studentName , have been initialized. Write a statement that adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Define function which takes a decimal number as an input

HOLMES INSTITUTE - HS1031 Introduction to Programming Assignment - Define a function conversion.py which takes a decimal number as an input

  Write python code using a while loop and prompt the user

Create a Python module called LoopsLab to illustrate the solutions to the following problems. Each problem may or may not build on the problem before it.

  Write a function named shift that shifts all elements

Write a function named shift that shifts all elements by one to the right and move the last element Into the first position.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd