473,715 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbee Question

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.

Aug 20 '07 #1
16 1005
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

Aug 20 '07 #2
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
Aug 20 '07 #3
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
Aug 20 '07 #4
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

Aug 20 '07 #5
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
Aug 20 '07 #6
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
Aug 20 '07 #7
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*m ax(stops-otStart,0)

-- Paul

Aug 20 '07 #8
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
Aug 20 '07 #9
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

Aug 20 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1927
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 images.... If i right click on the image the whole path is displayed on this way: http://www.test.com/Dir1/Dir2/Dir3/web/firstDir/secondDir/images/image.gif Should i define global variables(?) or how to solve this....
2
1658
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 .NET app to work? keep in mind I am a newbee :-) !! thanks --
4
1778
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) ************************************************* Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer) Dim YOE1 As Double
2
1870
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"
0
1409
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"?> <questions> <topic order="1" title="General"> <item order="1" question="blablabla?"> <answer>blablabla</answer>
9
341
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, Eric
1
2373
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 library to Jython and some parts are missing. My question basically is where do I find information on what to use instead. E.g. I could not find information on the os module. I do not find the sys module docu either. The concrete problem is I have...
2
1542
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 permission to access /quotes/'.$_SERVER.'> <table style= on this server. -------------------------------------------------------------------------------- Apache/2.0.59 (Win32) mod_jk/1.2.15 SVN/1.4.0 PHP/5.2.0 DAV/2 Server at
2
1416
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 pass these three urls to the function i already have ? The list size may change and does not necessary have to remain as 3 thanks for lifting a newbee to greater heights
0
1308
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 saved in my Sql Table.
0
8821
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8718
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9340
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9196
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6646
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5967
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3175
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2539
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.