#Workers in a company are paid £8 per hour for each hour they work up to a
#basic working week of 40 hours, and £12 an hour for any overtime they work.
#Write a program that asks the user to enter the number of hours worked
#and outputs the total pay for the week.
below is the which i have made, can cheak to see if it works. thnaks you -
workedhours = input ("\nPlease enter number of hours worked this week: ")
-
while workedhours > 40:
-
workedhours = input("Incorrect, please enter worked hours this week again:")
-
-
overtime = input ("Please enter number of overtime horus worked this week: ")
-
-
if workedhours <= 40:
-
print "\n\nStandard hourly rate is £8 per hour, so you will get paid: \t£",8*workedhours
-
-
elif workedhours >= 40:
-
print "Standard hourly rate is £8 per hour, so you will get paid: \t£",8*workedhours
-
-
print "Overtime rate is £12 per hour, so you will get paid: \t\t£",12*overtime
-
-
print "\nTotal pay for the week is: \t\t\t\t\t£",8*workedhours + 12*overtime
10 9785 bvdet 2,851
Recognized Expert Moderator Specialist
Please use code tags!! It works like this:
[code] .......code goes here......... [/code]
I created a new thread for you because you have asked a question unrelated to your previous question.
-BV
ok sorry, next time will do that, so can you cheak program, and see if works correclty.
bvdet 2,851
Recognized Expert Moderator Specialist
Yes, it works. Why did you need me to test it for you? You should test your own code by using an IDE such as IDLE. You can also run your script from the command prompt.
A couple of suggestions:
Use raw_input() instead of input(). This will avoid the possibility of someone entering malicious code.
Set up a while loop to validate the initial entry that should be 40 hours or less. Something like this: - while True:
-
workedhours = int(raw_input("\nPlease enter number of hours worked this week: "))
-
if workedhours > 40:
-
print "Incorrect, please enter worked hours this week again (must not be over 40)."
-
else: break
You don't need the if statement " if workedhours <= 40".
-BV
i have to Write a function called areaOfCircle() which takes as an input the radius and outputs the area of a circle with a radius of the given input (area = r2)
basically i am confused wht it means by write a fucntion, i have the code for this, but wht does it mean wirte a function. i have attched wht i have wriiten.
bvdet 2,851
Recognized Expert Moderator Specialist
Please, imran akhtar, do not ask new and unrelated questions in the same thread. Start a new thread. Please post your code in your message and enclose the code with code tags. This is preferable to viewing an attachment.
-BV
ok sorry for that, silly question how do i start . Start a new thread., due to the fact i cant seem find tab which says "NEW THREAD" and how does the enclose code tags looks like. sorry for the stupid questions.
bvdet 2,851
Recognized Expert Moderator Specialist
Under bytes > topic > python > answers, there should be a large button in the upper left of the window: "New Thread"
Code tags work like this:
[code]x + y = z
print z
[/code]
There is a code tag button on the toolbar in the "Reply to Thread" and "Post New Thread" windows. Highlight all your code, then select the code tag button.
no mate there is no button called NEW THREAD, thats the reason i been just posting new question and in the old thread, due to fact i could not find the button.
Do what bvdet says -- don't just look at your own thread! Instead, go all the way up to the top of the window above your thread, where it says "bytes > topic > python > answers", and click on "answers". Then you will see the "New Thread" button.
If you learn how the forum works, you will be so much more productive and people will be more willing to help you.
bvdet 2,851
Recognized Expert Moderator Specialist
Thanks bigturtle. I could not have said it better!
-BV
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: David Paschall |
last post by:
Can someone help me with totaling hrs worked on shift including past
midnite hrs.
Thanks
|
by: sg_s123 |
last post by:
============================================================================
02-Feb-04 03-Feb-04
Staff Staff 0800hr- 1300hr- 1700hr- 1900hr- 0800hr- 1300hr- 1700hr-
1900hr-
Number...
|
by: Del |
last post by:
Thanks in advance for any help.
I have a database that was created in Access 2000. Several users have
been upgraded to Access 2003. Since upgrading to 2003 we have noticed
that some of the...
|
by: Nigel C |
last post by:
My problem is best explained by way of tables and examples...
I am using Access 2000 (in case this is relevant) and I have a table
with the following fields...
Field names
------------
Code ...
|
by: Drum2001 |
last post by:
I have designed a "Time Tracker Database"... Basically a Time Clock. I
have report that calculates the number of regular hours worked per
week.
Currently I am running the following query:
...
| |
by: King |
last post by:
Hi
I have following MS Acess query
Here is the query
ID Name Prgm ID Client ID Date Start Time End
Time Minutes
C4 Trisha TIP DEK0703 7 /7 /2006...
|
by: Beowulf |
last post by:
I have data coming from a telephony system that keeps track of when an
employee makes a phone call to conduct a survey and which project number
is being billed for the time the employee spends on...
|
by: brendanmcdonagh |
last post by:
Hi,
I am designing a project for my friend as I am just a week old baby to vb and want to implement what I've learnt so far.
She wants to be able to put start time, end time and lunch for each...
|
by: lee123 |
last post by:
i have a form with timestarted and timeended and i have asked this question before but in access the way they did it was in a query but i don't know how to work the query in vb6 so maybe one of you...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |