Python Forum
Python for Everybody 3.1 assignment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python for Everybody 3.1 assignment
#1
Hi
I need help please
I tried and did not succeed
[Image: 762712825.png]
Reply
#2
You never print the pay. Give that a try.

Also - please don't post a screenshot of code again, post using code tags - https://python-forum.io/misc.php?action=help&hid=25
Generally, we strongly prefer text to screenshots.
Reply
#3
I did not understand what was required
So I asked for help
Reply
#4
use print to print the pay result
Reply
#5
My friend how I will reach output 498.75
What is the calculation of each asset to this output?

inp = input ("Enter Hours: ")
hours = float(inp)
inp = input("Enter Rate: ")
rate = float(inp)
if hours <=40 :
    pay = rate * hours
else :
    pay = rate * 40 + ( rate * 1.5 * (hors - 40) )
print("pay")
Reply
#6
As I said before, use code tags when posting code. See the link I provided before if you're unsure how.

Your calculation is correct, but you have two other bugs in your program. The first is that you misspelled hours on line 8. Have you tested your code? I highly recommend doing so before making posts online about it. The second bug is that on your last line, you have quotes around "pay" when you should not.
Reply
#7
I am sorry my friend
I am a beginner
I do not understand
Help me write the code

[Image: 322129304.png]


I have tested the code on Pycharm
I do not know what to put in order to get the output 498.75
Reply
#8
This should do the trick. Input 45 gives 498.75.
hours = float(input("Enter hours: "))
rate = 10.5
ratePlus = 10.5 * 1.5

if hours > 40:
    pay = 40 * rate + (hours - 40) * ratePlus

else:
    pay = hours * rate

print (pay)
Reply
#9
(Jan-06-2019, 06:24 PM)Mr_W Wrote: This should do the trick. Input 45 gives 498.75.
hours = float(input("Enter hours: "))
rate = 10.5
ratePlus = 10.5 * 1.5

if hours > 40:
    pay = 40 * rate + (hours - 40) * ratePlus

else:
    pay = hours * rate

print (pay)

http://www9.0zz0.com/2019/01/07/00/601889633.png
look my friend
Reply
#10
Looks like you're supposed to get the hourly rate as well, not hard-code it.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python for Everybody 5.2 assignment baba04201 20 172,662 Jul-25-2023, 04:15 PM
Last Post: MicaelSchutz
  Coursera python for everybody 5.2 assignment SteppentigerV2 11 12,704 Oct-22-2020, 11:57 AM
Last Post: Larz60+
  [split] Python for Everybody 5.2 assignment ramadan2099 3 11,979 Jul-15-2020, 04:54 PM
Last Post: Bipasha
  Python Assignment 3 - Applied Data Science - 2.3 eyavuz21 8 4,883 Jun-06-2020, 08:59 AM
Last Post: eyavuz21
  Python Password Saver Assignment sshellzr21 2 6,103 May-02-2020, 01:34 AM
Last Post: sshellzr21
  Python for Everybody 3.3 assignment ramadan2099 7 31,639 Apr-08-2020, 06:49 AM
Last Post: DeaD_EyE
  Python for everyone course assignment 5.2 ofekx 3 8,482 Dec-23-2019, 08:41 PM
Last Post: nilamo
  [split] Python for Everybody 5.2 assignment jonchanzw 4 8,403 Oct-22-2019, 08:08 AM
Last Post: perfringo
  Python Assignment 5.2 amos76823 3 15,914 Jan-17-2019, 07:34 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020