计算工作小时数 [英] Calculation of hours worked

查看:105
本文介绍了计算工作小时数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一家公司的工作人员每小时工资8英镑,工作时间为40小时工作周,每小时12英镑,工作加班费为每小时12英镑。 br />
#写一个程序,要求用户输入工作小时数

#并输出本周的总工资。


以下是我所做的,可以嘲笑它是否有效。 thnaks你

#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

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号

推荐答案

请使用代码标签!!它的工作方式如下:

[code] .......代码在这里......... [/ code]

我创建了一个你问过一个与前一个问题无关的问题。


-BV
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.


是的,它的工作原理。你为什么需要我为你测试一下?您应该使用IDLE等IDE来测试自己的代码。您还可以从命令提示符运行脚本。


一些建议:


使用raw_input()而不是input()。这将避免某人输入恶意代码的可能性。


设置while循环以验证应该是40小时或更短时间的初始条目。像这样:
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:
展开 | 选择 | Wrap | 行号


这篇关于计算工作小时数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆