Python for Everybody 3.1 assignment - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Python for Everybody 3.1 assignment (/thread-15116.html) Pages:
1
2
|
Python for Everybody 3.1 assignment - ramadan2099 - Jan-04-2019 Hi I need help please I tried and did not succeed [Image: 762712825.png] RE: Python for Everybody 3.1 assignment - micseydel - Jan-05-2019 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. RE: Python for Everybody 3.1 assignment - ramadan2099 - Jan-05-2019 I did not understand what was required So I asked for help RE: Python for Everybody 3.1 assignment - Axel_Erfurt - Jan-05-2019 use print to print the pay result RE: Python for Everybody 3.1 assignment - ramadan2099 - Jan-05-2019 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") RE: Python for Everybody 3.1 assignment - micseydel - Jan-05-2019 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. RE: Python for Everybody 3.1 assignment - ramadan2099 - Jan-05-2019 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 RE: Python for Everybody 3.1 assignment - Mr_W - Jan-06-2019 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) RE: Python for Everybody 3.1 assignment - ramadan2099 - Jan-06-2019 (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 RE: Python for Everybody 3.1 assignment - micseydel - Jan-06-2019 Looks like you're supposed to get the hourly rate as well, not hard-code it. |