Velocity Reviews > Newbee Question

# Newbee Question

HD1956
Guest
Posts: n/a

 08-20-2007
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.

kyosohma@gmail.com
Guest
Posts: n/a

 08-20-2007
On Aug 20, 9:23 am, "HD1956" <(E-Mail Removed)> wrote:
> 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

Shawn Milochik
Guest
Posts: n/a

 08-20-2007
On 8/20/07, http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote:
> On Aug 20, 9:23 am, "HD1956" <(E-Mail Removed)> wrote:
> > 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

Diez B. Roggisch
Guest
Posts: n/a

 08-20-2007
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

kyosohma@gmail.com
Guest
Posts: n/a

 08-20-2007
On Aug 20, 9:58 am, "Shawn Milochik" <(E-Mail Removed)> wrote:
> On 8/20/07, (E-Mail Removed) <(E-Mail Removed)> wrote:
>
>
>
> > On Aug 20, 9:23 am, "HD1956" <(E-Mail Removed)> wrote:
> > > 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

Shawn Milochik
Guest
Posts: n/a

 08-20-2007
> 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

Wildemar Wildenburger
Guest
Posts: n/a

 08-20-2007
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

Paul McGuire
Guest
Posts: n/a

 08-20-2007
On Aug 20, 9:23 am, "HD1956" <(E-Mail Removed)> wrote:
> 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

Neil Cerutti
Guest
Posts: n/a

 08-20-2007
On 2007-08-20, HD1956 <(E-Mail Removed)> wrote:
> 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

hd1956@yahoo.com
Guest
Posts: n/a

 08-20-2007
On Aug 20, 11:06 am, (E-Mail Removed) wrote:
> On Aug 20, 9:58 am, "Shawn Milochik" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On 8/20/07, (E-Mail Removed) <(E-Mail Removed)> wrote:

>
> > > On Aug 20, 9:23 am, "HD1956" <(E-Mail Removed)> wrote:
> > > > 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