Reply
Results 1 to 6 of 6
  1. #1
    aka cheeseburger walrus MustardTiger17's Avatar
    Join Date: Dec 2012
    Location: United States
    Posts: 16,681
    Rep Power: 75436
    MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000) MustardTiger17 has a brilliant future. Third best rank! (+40000)
    MustardTiger17 is offline

    Help with rudimentary python code (reps)

    The prompt is:

    Write a program to prompt the user for hours and rate per hours using input to compute gross pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked above 40 hours. Use 45 hours and a rate of 10.50 per hour to test the program. ( The pay should be 498.75)

    My code is:

    hrs = input('Enter Hours: ')
    rte = input('Enter Rate: ')
    fhrs = float(hrs)
    frte = float(rte)
    if fhrs <= 40 :
    pr = fhrs * frte
    print(pr)
    elif fhrs > 40 :
    pr = (((fhrs - 40) * (1.5 * 10.50)) + (fhrs * frte))
    print(pr)

    My output is 551.25 and the desired output is 498.75

    I have the correct spacing below the "if" and "elif" but for some reason my spaces aren't showing up when I post.
    "And I swear to God if I saw any of you guys, if I-- you know what I'm going to do, how about this you guys? I'm going to hack into your ****ing computer and I'm gonna find where you live, I'm gonna come and beat you in your ****ing sleep. Don't run your mouth anymore peace out."

    -The Iron Toenail

    Las Vegas Crew

    Oči Pičo
    Reply With Quote

  2. #2
    Registered User 5431's Avatar
    Join Date: Dec 2008
    Age: 8
    Posts: 5,551
    Rep Power: 6778
    5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000) 5431 is a name known to all. (+5000)
    5431 is offline
    while(true):
    print("op is a phaggot")
    Reply With Quote

  3. #3
    Registered User paulinkansas's Avatar
    Join Date: Sep 2018
    Posts: 1,471
    Rep Power: 7603
    paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000) paulinkansas is a name known to all. (+5000)
    paulinkansas is offline
    Change your hourly rate (X) to where pr = 498.75 in the equation pr = (((fhrs - 40) * (1.5 * X)) + (fhrs * frte))
    Reply With Quote

  4. #4
    Registered User whitepaper's Avatar
    Join Date: Jun 2011
    Posts: 9,504
    Rep Power: 19373
    whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000) whitepaper is a splendid one to behold. (+10000)
    whitepaper is offline
    Originally Posted by MustardTiger17 View Post
    pr = (((fhrs - 40) * (1.5 * 10.50)) + (fhrs * frte))

    The last portion of the equation is essentially adding the TOTAL hours worked (45 in this case) by the regular rate, instead of the base 40.


    The input would be (((45-40)*(1.5*10.5))+(45*10.5))


    Hopefully that guides you in the right direction
    2014 Misc Resolution: Negging no pics (screen captures of text don't count as pics)
    Reply With Quote

  5. #5
    Registered User BulkingIsHard's Avatar
    Join Date: Aug 2016
    Posts: 2,926
    Rep Power: 17067
    BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000) BulkingIsHard is a splendid one to behold. (+10000)
    BulkingIsHard is offline
    Your coding sytnax is fine but your math/logic is wrong. You want only the overtime hours to get 1.5x the rate, not the entire duration.

    Solution:
    Spoiler!
    Beer Flu Race War Boogaloo Crew
    Vote Constitutionalist Crew
    Giant Meteor 2020
    Reply With Quote

  6. #6
    Registered User varojack's Avatar
    Join Date: May 2020
    Age: 50
    Posts: 1
    Rep Power: 0
    varojack is on a distinguished road. (+10)
    varojack is offline
    It is possible to create a DMARC checker with python ?
    Reply With Quote

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts