Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Newbee Question

Reply
Thread Tools

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.

 
Reply With Quote
 
 
 
 
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

 
Reply With Quote
 
 
 
 
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
 
Reply With Quote
 
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
 
Reply With Quote
 
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

 
Reply With Quote
 
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
 
Reply With Quote
 
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
 
Reply With Quote
 
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

 
Reply With Quote
 
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
 
Reply With Quote
 
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
total newbee question Jim ODonnell Firefox 11 12-25-2004 08:24 AM
Newbee question Who ASP .Net 8 04-05-2004 07:34 PM
Newbee question: How to kill a cookie? Valmir ASP .Net 3 02-18-2004 12:58 PM
NewBee Type Question about displaying text vbGansta ASP .Net 0 02-16-2004 06:36 PM
Newbee question: Adrian Cisco 3 11-29-2003 01:46 PM



Advertisments