This is probably a simple code. I am a truck driver who gets paid by
stops and cases. I am trying to figure out how to code my stop pay. I
get 40 cents per stop up to 22 stops, and $1.40 per stops after that. 16 988
On Aug 20, 9:23 am, "HD1956" <hd7...@hotmail.comwrote:
This is probably a simple code. I am a truck driver who gets paid by
stops and cases. I am trying to figure out how to code my stop pay. I
get 40 cents per stop up to 22 stops, and $1.40 per stops after that.
def calc(num):
if num < 23:
return 0.4 * num
else:
overtime = num - 22
x = 0.4 * 22
x += overtime * 1.4
return x
# Use your own brain next time
Mike
On 8/20/07, ky******@gmail.com <ky******@gmail.comwrote:
On Aug 20, 9:23 am, "HD1956" <hd7...@hotmail.comwrote:
This is probably a simple code. I am a truck driver who gets paid by
stops and cases. I am trying to figure out how to code my stop pay. I
get 40 cents per stop up to 22 stops, and $1.40 per stops after that.
def calc(num):
if num < 23:
return 0.4 * num
else:
overtime = num - 22
x = 0.4 * 22
x += overtime * 1.4
return x
# Use your own brain next time
Mike
-- http://mail.python.org/mailman/listinfo/python-list
Mike,
I wonder if we were both just duped into helping someone with their homework...
Shawn
HD1956 schrieb:
This is probably a simple code. I am a truck driver who gets paid by
stops and cases. I am trying to figure out how to code my stop pay. I
get 40 cents per stop up to 22 stops, and $1.40 per stops after that.
Sounds a bit like homework. Which usually isn't simply delivered here.
Can you show us some code you worked on, then we might suggest enhancements.
Diez
On Aug 20, 9:58 am, "Shawn Milochik" <Sh...@Milochik.comwrote:
On 8/20/07, kyoso...@gmail.com <kyoso...@gmail.comwrote:
On Aug 20, 9:23 am, "HD1956" <hd7...@hotmail.comwrote:
This is probably a simple code. I am a truck driver who gets paid by
stops and cases. I am trying to figure out how to code my stop pay. I
get 40 cents per stop up to 22 stops, and $1.40 per stops after that.
def calc(num):
if num < 23:
return 0.4 * num
else:
overtime = num - 22
x = 0.4 * 22
x += overtime * 1.4
return x
# Use your own brain next time
Mike
-- http://mail.python.org/mailman/listinfo/python-list
Mike,
I wonder if we were both just duped into helping someone with their homework...
Shawn
I like to write code, so it's not a big deal when it's something so
simple. Still, that is beyond dumb! Nice code, by the way.
Mike
I like to write code, so it's not a big deal when it's something so
simple. Still, that is beyond dumb! Nice code, by the way.
Mike
Yeah, it was fun to write anyway. Thanks for the compliment on the
code. I still consider myself a Python newbie, so it's good to know
I'm not trying to write it like Perl or VBScript anymore. ^_^
Shawn
Diez B. Roggisch wrote:
Sounds a bit like homework. Which usually isn't simply delivered here.
Wrong! Usually that happens pretty quickly here (as proven again in this
case). Not that it should, but only the seniors seem to detect lazy
learners.
/W
On Aug 20, 9:23 am, "HD1956" <hd7...@hotmail.comwrote:
This is probably a simple code. I am a truck driver who gets paid by
stops and cases. I am trying to figure out how to code my stop pay. I
get 40 cents per stop up to 22 stops, and $1.40 per stops after that.
You'll get top marks for turning in the shortest program!
norm = 0.4
ot = 1.4-norm
otStart = 22
calcPay = lambda stops : norm*stops+ot*max(stops-otStart,0)
-- Paul
On 2007-08-20, HD1956 <hd****@hotmail.comwrote:
This is probably a simple code. I am a truck driver who gets
paid by stops and cases. I am trying to figure out how to code
my stop pay. I get 40 cents per stop up to 22 stops, and $1.40
per stops after that.
I wish *I* could make a deal like that. I stop working all the
time!
--
Neil Cerutti
Customers who consider our waitresses uncivil ought to see the manager --sign
at New York restaurant
On Aug 20, 11:06 am, kyoso...@gmail.com wrote:
On Aug 20, 9:58 am, "Shawn Milochik" <Sh...@Milochik.comwrote:
On 8/20/07, kyoso...@gmail.com <kyoso...@gmail.comwrote:
On Aug 20, 9:23 am, "HD1956" <hd7...@hotmail.comwrote:
This is probably a simple code. I am a truck driver who gets paid by
stops and cases. I am trying to figure out how to code my stop pay. I
get 40 cents per stop up to 22 stops, and $1.40 per stops after that.
def calc(num):
if num < 23:
return 0.4 * num
else:
overtime = num - 22
x = 0.4 * 22
x += overtime * 1.4
return x
# Use your own brain next time
Mike
--
>http://mail.python.org/mailman/listinfo/python-list
Mike,
I wonder if we were both just duped into helping someone with their homework...
Shawn
I like to write code, so it's not a big deal when it's something so
simple. Still, that is beyond dumb! Nice code, by the way.
Mike- Hide quoted text -
- Show quoted text -
Thanks for the help. By the way I am trying to learn the python after
work and on weekends. If it was a dumb question, to this group, I will
not bother you all again.
Without help it will take me longer to learn. Thanks
Oh well since a few solutions have already been posted I thought I
might add another, just so you at the very least you have to do some
work making up your mind which one to choose. Using an incremental
approach just to be different ...
from decimal import Decimal
normal = Decimal('0.04')
over = Decimal('1.40)
def calcStopPay (stops) :
pay = Decimal('0.00')
while stops :
incr = normal if stops < 23 else over
pay += incr
stops -= 1
return pay
#testing:
for x in range(50) :
print "Stop pay for %s stops: $%s" % (x, calcStopPay(x))
On Aug 21, 5:41 pm, Asun Friere <afri...@yahoo.co.ukwrote:
over = Decimal('1.40)
oops, that should of course be:
over = Decimal('1.40')
On Aug 21, 5:51 pm, Asun Friere <afri...@yahoo.co.ukwrote:
On Aug 21, 5:41 pm, Asun Friere <afri...@yahoo.co.ukwrote:over = Decimal('1.40)
oops, that should of course be:
over = Decimal('1.40')
oh boy ... and it should also be
normal = Decimal('0.40')
I really need to test before posting ... hd****@yahoo.com wrote:
[...]
>
Thanks for the help. By the way I am trying to learn the python after
work and on weekends. If it was a dumb question, to this group, I will
not bother you all again.
Without help it will take me longer to learn. Thanks
Don't worry about it. There is also a list specifically for learners,
which you can find out about at http://mail.python.org/mailman/listinfo/tutor
Welcome to the Python community!
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading ------------- hd****@yahoo.com wrote:
[...]
>
Thanks for the help. By the way I am trying to learn the python after
work and on weekends. If it was a dumb question, to this group, I will
not bother you all again.
Without help it will take me longer to learn. Thanks
Don't worry about it. There is also a list specifically for learners,
which you can find out about at http://mail.python.org/mailman/listinfo/tutor
Welcome to the Python community!
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
On Aug 21, 11:52 am, "hd1...@yahoo.com" <hd1...@yahoo.comwrote:
I tryed your code and got an error message #I use Wing IDE:
Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
Evaluating lines 1-16 from truckStops.py
<string>:7: Warning: 'yield' will become a reserved keyword in the
future
Could not execute because an error occurred:
invalid syntax: <string>, line 7, pos 19:
yield stops, wage
Python 2.2.3 is three versions behind. Generators only work in 2.2 by
saying:
from __future__ import generators
And by default in anything from 2.3 on.
Fred
On Aug 21, 2:57 am, Dennis Lee Bieber <wlfr...@ix.netcom.comwrote:
[...]
>
pay = min(num, 22) * 0.4 + max(num-22, 0) * 1.4
pay = num*0.4 + (num>22)*(num-22)
;-)
-=Dave This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Newbee |
last post by:
Hi !
Let's say that this is the folder on the server:
/web/firstDir/secondDir/images/image.gif
where i have stored my pictures. I have tryed with apsolute and relative
paths but i can't display...
|
by: Newbee Adam |
last post by:
some said that .NET app can run on any program where rutime exists. What is
"runtime" in this sense?
will I have to install runtime or .net framework or .NET support on an xp
machine for a...
|
by: PerryC |
last post by:
All,
1. Do the following codes seem ok?
2. If so, then how do I pull the value of YOE1 and YOE2 into my
report? (to do some further calculations)
...
|
by: Martin Hvidberg |
last post by:
Dear list
I have found a declaration like this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "ectemp.h"
|
by: valmir cinquini |
last post by:
i'm developing a faq session of our website and I'm facing some
problems handling xml files and DataSet relations
First off all, here's the structure of my xml file:
<?xml version="1.0"?>...
|
by: EMW |
last post by:
I have created a page in aspx and after a click on a button, a new page
should open.
How is this possible?
I tried it doing it like in vb.NET with opening a new form, but it doesn't
work.
rg,...
|
by: Mark Fink |
last post by:
Hi there,
unfortunately I am new to Jython and my "Jython Essentials" book is
still in the mail. I looked into the Jython API Doc but could not find
the information.
I am porting a Python...
|
by: IchBin |
last post by:
I am trying to clean up my code. I have run it through tidy and now have
the code below. The problem is that anytime I select a radio button I
get the following error:
Forbidden
You don't have...
|
by: Mel |
last post by:
I have a selection box with 3 values. what i need is to pass 3 urls to
a function that has a switch statement and based on the selection
index goes on one of the tree urls.
Question is how do i...
|
by: Martin Arvidsson, Visual Systems AB |
last post by:
Hi!
I have a couple of newbee questions.
I have a .aspx page with a couple of TextBoxes and a submit button.
Now...
When i press the submitbutton i want the data in the TextBoxes to be...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |