4.6 assignment python for everybody

Assignment 4.6 | Week-6 | Programming for Everybody (Getting Started with Python) By Coursera

Assignment 4.6 | Week-6 | Programming for Everybody (Getting Started with Python) By Coursera

Coursera Programming for Everybody (Getting Started with Python) Week 6  Assignment 4.6 

 Question:      4.6 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay should be the normal rate for hours up to 40 and time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to do the computation of pay in a function called computepay() and use the function to do the computation. The function should return a value. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). You should use input to read a string and float() to convert the string to a number. Do not worry about error checking the user input unless you want to – you can assume the user types numbers properly. Do not name your variable sum or use the sum() function.

Assignment 4.6 | Week-6 | Programming for Everybody (Getting Started with Python) By Coursera

Do Not Only Use These Quizzes For Getting Certificates.You Can Take Help From These Quizzes Answer. All Quizzes & Contents Are Free Of Charge. ✅ If You Want Any Quiz Answers Then Please  Contact Us

Related Questions & Answers:

Leave a comment cancel reply, please enable javascript in your browser to visit this site..

Instantly share code, notes, and snippets.

@acmarsnik

acmarsnik / py4e-pfe-4_6-computePayV4.py

  • Download ZIP
  • Star ( 0 ) 0 You must be signed in to star a gist
  • Fork ( 0 ) 0 You must be signed in to fork a gist
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.
  • Learn more about clone URLs
  • Save acmarsnik/46398ce33f559545c03ab51f58dbe2a4 to your computer and use it in GitHub Desktop.
def computepay(h,r):
if h <= 40.0:
p = h * r
else:
p = 40.0 * r
p += (h - 40.0) * (r * 1.5)
p = round(p, 2)
return p
hrs = input("Enter Hours:")
try:
hrs = float(hrs)
rate = input("Enter Rate:")
try:
rate = float(rate)
pay = computepay(hrs, rate)
print(pay)
except:
print('Error, please enter numeric input')
except:
print('Error, please enter numeric input')

@acmarsnik

acmarsnik commented Nov 19, 2017

Write a program to prompt the user for hours and rate per hour to compute gross pay.

Sorry, something went wrong.

Desired Prompt 1: Enter Hours: Example Input 1: 35 Desired Prompt 2: Enter Rate: Example Input 2: 2.75 Desired Output: Pay: 96.25

We won't worry about making sure our pay has exactly two digits after the decimal place for now. If you want, you can play with the built-in Python round function to properly round the resulting pay to two decimal places.

Rewrite your pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours.

acmarsnik commented Nov 19, 2017 • edited Loading

Rewrite your pay program using try and except so that your program handles non-numeric input gracefully by printing a message and exiting the program. The following shows two executions of the program:

Enter Hours: 20 Enter Rate: nine Error, please enter numeric input

Enter Hours: forty Error, please enter numeric input

Rewrite your pay computation with time-and-a-half for overtime and create a function called computepay which takes two parameters (hours and rate).

Python for Everybody

Exercise 4.1, exercise 4.2, exercise 4.6, exercise 4.7.

  • ← Previous
  • All (5 / 17)
  • → Next

Take a brief look at how Python implements the 'store and use later' programming pattern.

  • Functions - Part 1 (10:50)
  • Functions - Part 2 (12:35)
  • Worked Exercise 4.6 (10:08)
  • Pythonlearn-04-Functions.pptx
  • Chapter 4: Functions
  • Functions (Login Required)
  • Autograder: Exercise 4.6 (Login Required)
  • Quiz: Functions (Login Required)

Get the Reddit app

Subreddit for posting questions and asking for general advice about your python code.

Coursera Programming for Everybody (Getting Started with Python) Week 6 Assignment

Ques: Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay should be the normal rate for hours up to 40 and time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to do the computation of pay in a function called computepay() and use the function to do the computation. The function should return a value. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75).

def computepay(hrs,r):

if hrs <= 40:

pay = r * hrs

elif hrs > 40:

b = ((hrs - 40) * 1.5)

pay = (a + b)

hrs = float(input("Enter Hours:"))

r=float(input())

p = computepay(hrs,r)

print("Pay",p)

# Behind the Seen :

This Ques. wasted my a lot of time i have tried many time because this problem is too easy and we can solve this problem in many way but in Coursera answer accepted only in this way and also here 1.5 times is wrong actually it has to be 0.5 but ...

By continuing, you agree to our User Agreement and acknowledge that you understand the Privacy Policy .

Enter the 6-digit code from your authenticator app

You’ve set up two-factor authentication for this account.

Enter a 6-digit backup code

Create your username and password.

Reddit is anonymous, so your username is what you’ll go by here. Choose wisely—because once you get a name, you can’t change it.

Reset your password

Enter your email address or username and we’ll send you a link to reset your password

Check your inbox

An email with a link to reset your password was sent to the email address associated with your account

Choose a Reddit account to continue

assignment 4.6 python for everybody

def computepay(h,r):<br/> if h > 40:<br/> pa = 40 * r + (h-40)*1.5*r<br/> else:<br/> pa = h * r<br/> return pa<br/><br/>hrs = input("Enter Hours:")<br/>h = float(hrs)<br/>rate = input("Enter Rate")<br/>r = float(rate)<br/>p = computepay(h,r)<br/><br/>print("Pay",p)

Welcome Back!

  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings

Create a Free Account

Mark the violation.

user3748908

assignment 4.6 python for everybody

4.6 assignment python for everybody

  • class item assignment python
  • how to use with statement in python 2.5 and earlier
  • python for continue
  • conda python 3.8
  • how to use with statementin python 2.4
  • assignment 7.1 python data structures
  • for schleife python
  • 0 1 1 2 3 5 in python
  • how to crack a 4 way handshake with python
  • assignment 6.5 python for everybody
  • walrus operator python 3.8
  • cant install tensorflow pip python 3.6
  • pip install for python 2 and python3
  • how to upgrade python from 2.7 to 2.9 on ubuntu 14.04
  • cors assignment 4.6 python
  • python fundamentals assignment solutions pdf
  • install python 3.6
  • 56.5 to 57 in python
  • python 0-1 kanpsack

4.6 assignment python for everybody

New to Communities?

4.6 assignment python for everybody

IMAGES

  1. Coursera

    4.6 assignment python for everybody

  2. Coursera: Python For Everybody Assignment 4.6 program solution

    4.6 assignment python for everybody

  3. Python For Everybody Assignment 4.6 program solution

    4.6 assignment python for everybody

  4. Python for Everybody Answers

    4.6 assignment python for everybody

  5. Programming for Everybody (Getting Started with Python) ||Week 6 || Assignment 4.6 Coursera

    4.6 assignment python for everybody

  6. Coursera Python for Everybody EP-11

    4.6 assignment python for everybody

COMMENTS

  1. python-for-everybody/wk4

    wk4 - assignment 4.6.py. Cannot retrieve latest commit at this time. History. Code. Blame. 17 lines (13 loc) · 897 Bytes. 4.6 Write a program to prompt the user for hours and rate per hour using raw_input to compute gross pay. Award time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to do the computation of ...

  2. Assignment 4.6

    CourseraProgramming for Everybody (Getting Started with Python)Week 6 Assignment 4.6 Question: 4.6 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay should be the normal rate for hours up to 40 and time-and-a-half for the hourly rate for all hours worked above…

  3. Python for everybody

    The second pay should be beneath se of the else: and lastly return pay should be in alignment with else: so it should be if hours, else: and return pay aligned correctly and the same for pay by using the space bar in your pc. There two spaces after lines:6 and 10. Python for everybody - Assignment 4.6. GitHub Gist: instantly share code, notes ...

  4. Programming-for-Everybody-Getting-Started-with-Python-/Assignment-4.6

    A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior.

  5. Coursera-Python-for-everybody-Solution/Assignment 4.6 at ...

    Answer to all the assignments of the Coursera course - Zeus272000/Coursera-Python-for-everybody-Solution

  6. Coursera Python for Everybody EP-11

    Hi guys, in this video I solved the assignment 4.6 of Coursera Python for Everybody. Hope you find it useful.If you're new, Subscribe! https://www.youtube....

  7. Python For everybody Assignment 4.6 · GitHub

    Python For everybody Assignment 4.6 Raw. Assignment 4.6. Py This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters ...

  8. Python For Everybody Specialization, Programming for Everybody ...

    Python For Everybody Specialization, Programming for Everybody (Getting Started with Python), Assignment 4.6: Compute Pay V4 - py4e-pfe-4_6-computePayV4.py

  9. Coursera : python for everybody assignment 4.6 solution

    Program :hrs = input("Enter hours")rat = input("Enter rates")h = float(hrs)r = float(rat)additionalhours = h - 40a = float(additionalhours)def computepay(h, ...

  10. Python For Everybody Assignment 4.6 program solution

    Coursera: Python For Everybody Assignment 4.6 program solution | Assignment 4.6 Python For EverybodyQ.) 4.6 Write a program to prompt the user for hours and ...

  11. Coursera---Programming-for-Everybody-Getting-Started-with-Python-/Week

    this contains all the answers to the quizes and asssignments for "Programming for Everybody (Getting Started with Python)" on Coursera by the University of Michigan. - Coursera---Programming-for-Everybody-Getting-Started-with-Python-/Week 6- Assignment 4.6 at master · Ritik2703/Coursera---Programming-for-Everybody-Getting-Started-with-Python-

  12. Projects

    Exercise 4.6. """ Exercise 4.6: Rewrite your pay computation with time-and-a-half for overtime and create a function called computepay which takes two paramteters (hours and rate). Enter Hours: 45 Enter Rate: 10 Pay: 475.0 Python for Everybody: Exploring Data Using Python 3 by Charles R. Severance Solution by Jamison Lahman, May 28, 2017 ...

  13. PY4E

    Functions. Take a brief look at how Python implements the 'store and use later' programming pattern. Videos. Functions - Part 1 (10:50) Functions - Part 2 (12:35) Worked Exercise 4.6 (10:08) Slides. Pythonlearn-04-Functions.pptx. References.

  14. Programming for everybody / getting started with python assignment 4.6

    In this exercise I was given a task to simplify the conditional code to a 1 line expression by integrating the def function and return value

  15. Coursera Programming for Everybody (Getting Started with Python) Week 6

    Put the logic to do the computation of pay in a function called computepay () and use the function to do the computation. The function should return a value. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). Solution: def computepay (hrs,r): if hrs <= 40: pay = r * hrs. elif hrs > 40:

  16. Assignment solutions for python for everybody

    Python 100.0%. Assignment solutions for python for everybody. Contribute to sweehors/python-for-everybody development by creating an account on GitHub.

  17. assignment 4.6 python for everybody

    assignment 4.6 python for everybody. if h > 40: pa = 40 * r + (h-40)*1.5*r. else: pa = h * r. return pa.

  18. Coursera

    Coursera| Programming For Everybody Assignment 4.6 program solution Answer | Python for Everybody Assignment 4.6 program solution

  19. assignment 4.6 python for everybody

    Get code examples like"assignment 4.6 python for everybody". Write more code and save time using our ready-made code examples.

  20. Python for Everybody Answers

    The video is about the solution of the mentioned assignment of the python course named 'PYTHON FOR EVERYBODY' on coursera by Dr. Chuck

  21. Coursera: Assignment 4.6 //Python for everybody Assignment Solution

    # Coursera :- #Programing for everybody # Python👇👇Programing Run code link🔗 👇👇https://1drv.ms/w/s!AspSlroH33QidDYo5mP0BWn6dic_____...

  22. EngineerInd/Coursera-Python-for-everybody-solutions

    Hello friends, In this video we discussed about Coursera programming for everybody Assignment 5.2 answer other way it's known as Python for everybody Exercise 5.2 Complete program In this course Assignment (Exercise) are available in week 7 part.