Python Forum

Full Version: Python for Everybody 3.1 assignment
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi
I need help please
I tried and did not succeed
[Image: 762712825.png]
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.
I did not understand what was required
So I asked for help
use print to print the pay result
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")
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.
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
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)
(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
Looks like you're supposed to get the hourly rate as well, not hard-code it.
Pages: 1 2