Jan-04-2019, 11:58 PM
Python for Everybody 3.1 assignment
Python for Everybody 3.1 assignment
|
Jan-05-2019, 12:14 AM
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.
Jan-05-2019, 10:39 AM
I did not understand what was required
So I asked for help
Jan-05-2019, 11:09 AM
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")
Jan-05-2019, 04:13 PM
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.
Jan-05-2019, 06:59 PM
(This post was last modified: Jan-05-2019, 07:12 PM by ramadan2099.)
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
Jan-06-2019, 06:24 PM
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, 09:51 PM
(Jan-06-2019, 06:24 PM)Mr_W Wrote: This should do the trick. Input 45 gives 498.75. http://www9.0zz0.com/2019/01/07/00/601889633.png look my friend
Jan-06-2019, 11:12 PM
Looks like you're supposed to get the hourly rate as well, not hard-code it.
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Python for Everybody 5.2 assignment | baba04201 | 20 | 184,141 |
Jul-25-2023, 04:15 PM Last Post: MicaelSchutz |
|
Coursera python for everybody 5.2 assignment | SteppentigerV2 | 11 | 15,708 |
Oct-22-2020, 11:57 AM Last Post: Larz60+ |
|
[split] Python for Everybody 5.2 assignment | ramadan2099 | 3 | 13,198 |
Jul-15-2020, 04:54 PM Last Post: Bipasha |
|
Python Assignment 3 - Applied Data Science - 2.3 | eyavuz21 | 8 | 6,700 |
Jun-06-2020, 08:59 AM Last Post: eyavuz21 |
|
Python Password Saver Assignment | sshellzr21 | 2 | 7,319 |
May-02-2020, 01:34 AM Last Post: sshellzr21 |
|
Python for Everybody 3.3 assignment | ramadan2099 | 7 | 33,925 |
Apr-08-2020, 06:49 AM Last Post: DeaD_EyE |
|
Python for everyone course assignment 5.2 | ofekx | 3 | 9,659 |
Dec-23-2019, 08:41 PM Last Post: nilamo |
|
[split] Python for Everybody 5.2 assignment | jonchanzw | 4 | 9,607 |
Oct-22-2019, 08:08 AM Last Post: perfringo |
|
Python Assignment 5.2 | amos76823 | 3 | 17,022 |
Jan-17-2019, 07:34 AM Last Post: perfringo |
Users browsing this thread: 1 Guest(s)