Question

INSTRUCTION AND PROBLEMS Write a Python program for each of the problems in this lab. Please use PyCharm to type and test you

The following is an example Enter kilowatt hours used: 510 Please pay this amount: 61.50 Save your Python program in a file n

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def main():
    kwh = float(input("Enter kilowatt hours used: "))
    bill_calculator(kwh)


def bill_calculator(kwh):
    if kwh <= 500:
        charge = kwh * 0.12
    else:
        charge = 500 * 0.12 + ((kwh - 500) * 0.15)
    print("Please pay this amount: {:.2f}".format(charge))


if __name__ == '__main__':
    main()

Please pay this amount: 61.50 Process finished with exit code 0

Add a comment
Know the answer?
Add Answer to:
INSTRUCTION AND PROBLEMS Write a Python program for each of the problems in this lab. Please...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use...

    Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use in a month, the higher the energy bill. A power company charges customers $0.12 per kWh for the first 500 kWh. After the first 500 kWh, the rate is $0.15 per kWh. Write a program to calculate energy charge. You must write and use the following two functions. (a) A main function: Ask the user to enter number of kWh used. Call the bill_calculator...

  • PROBLEM 3 Rewrite Program 2. This is you must use keyword arguments to pass number of kWh and customer type to the bill_calculator function when it is called. Save your Python program in a file named Lab07P3.py. Submit the file to Blackboard for cred

    Problem 3  Rewrite Program 2.  This is you must use keyword arguments to pass number of kWh and customer type to the bill_calculator function when it is called. Save your Python program in a file named Lab07P3.py.  Submit the file to Blackboard for credit.This is what i wrote for prgram 2:():     kwh = (())     cus = (())     cus.upper()     bill_calculator(kwhcus) (kwhcus):     kwh <= cus == :         price = kwh * kwh > cus == :         price = * + ((kwh - ) * )     kwh <= cus == :         price = kwh * kwh > cus == :         price = * + ((kwh - ) * )     (.format(price))

  • Write a python program for the following problem? 100. Cost of Electricity formula The cost of...

    Write a python program for the following problem? 100. Cost of Electricity formula The cost of the electricity used by a device is given by the cost of electricity (in dollars) = wattage of device. hours used 1,000 · cost per kWh (in cents) where kWh is an abbreviation for "kilowatt hour.” The cost per kWh of electricity varies with locality. Suppose the current average cost of electricity for a residential customer in the United States is 11.76¢ per kWh....

  • Please use Python for this program Random Number File Writer Write a program that writes a...

    Please use Python for this program Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range 1 through 500. The program should let the user specify how many random numbers to put into the file. The name of the file to write to should be 'random.txt'. Submit the random.txt file generated by your program with the assignment. Sample program execution: Python 3.4.3 Shell Eile Edit...

  • Python Program 5. Write a Python program in a file named validTime.py. Include a function named...

    Python Program 5. Write a Python program in a file named validTime.py. Include a function named string parameter of the form hh:mm: ss in which these are numeric validTime that takes a values and returns True or False indicating whether or not the time is valid. The number of hours, minutes, and seconds must two digits and use a between 0 and 9). The number of hours must be between 0 and 23, the number of minutes and seconds must...

  • Lab 1 Q1. Write a Python program with the following function building block. •All input values...

    Lab 1 Q1. Write a Python program with the following function building block. •All input values are to be taken fro m the user. •Ensure to check for possible error cases like mismatch of data type and input out of range, for every function.       Function 1: countVowels(sentence) – Function that returns the count of vowels in a sentence. Function 2: Sum of all even numbers between two numbers, identify number of parameters   Q2. Write a Python program that reads a...

  • Selective Copy. Using Python program, write a program that walks through a folder tree and searches...

    Selective Copy. Using Python program, write a program that walks through a folder tree and searches for files with a certain file extension (such as .pdf or .jpg). Copy these files from whatever location they are in to a new folder. Submit the code and a screenshot of the program running in Linux

  • For each problem, you must: Write a Python program Test, debug, and execute the Python program...

    For each problem, you must: Write a Python program Test, debug, and execute the Python program Save your program in a .py file and submit your commented code to your Student Page. Note regarding comments: For every class, method or function you create, you must provide a brief description of the what the code does as well as the specific details of the interface (input and output) of the function or method. (25 pts.) Write a program that reads in...

  • The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for...

    The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for the first 300 kwh 8 cents per kwh for the next 300 kwh (up to 600 kwh) 6 cents per kwh for the next 400 kwh (up to 1000 kwh) 5 cents per kwh for all electricity used over 1000 kwh Write a program that would repeatedly read in a customer number (an integer) and the usage for that customer in kwh (an integer)....

  • Please help with this python assignment. Thank you. question 1 Write a Python program to read...

    Please help with this python assignment. Thank you. question 1 Write a Python program to read a file line by line store it into a variable. question 2 Write a Python program to read a file line by line store it into an array. question 3 Write a python program to find the longest words. question 4 Write a Python program to count the number of lines in a text file. question 5 Write a Python program to count the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT