Re: Help with some python homework...

2014-02-02 Thread David Hutto
price_per_book = 24.95 discount = .40 quantity = 60 Here: discounted_price = (1-discount) * price_per_book The discounted price should be price_per_book - discount shipping = 3.0 + (60 - 1) * .75 shipping should be, I think, should be 3.0 + (quantity * .75) total_price = 60 * discounted_price

Re: Help with some python homework...

2014-02-02 Thread MRAB
On 2014-02-02 16:11, David Hutto wrote: price_per_book = 24.95 discount = .40 quantity = 60 The original problem says: Suppose the cover price of a book is $24.95, but bookstores get a 40% discount. Shipping costs $3 for the first copy and 75 cents for each additional copy. What is the total

Re: Help with some python homework...

2014-02-02 Thread David Hutto
On Sunday, February 2, 2014 11:11:07 AM UTC-5, David Hutto wrote: price_per_book = 24.95 discount = .40 quantity = 60 Here: discounted_price = (1-discount) * price_per_book The discounted price should be price_per_book - discount shipping = 3.0 + (60 - 1) * .75

Re: Help with some python homework...

2014-02-02 Thread David Hutto
On Sunday, February 2, 2014 11:38:57 AM UTC-5, MRAB wrote: On 2014-02-02 16:11, David Hutto wrote: price_per_book = 24.95 discount = .40 quantity = 60 The original problem says: Suppose the cover price of a book is $24.95, but bookstores get a 40% discount. Shipping

Re: Help with some python homework...

2014-02-02 Thread Rhodri James
On Sat, 01 Feb 2014 05:18:34 -, Scott W Dunning swdunn...@cox.net wrote: Any chance you guys could help with another question I have? Below is a code to a different problem. The only thing I don’t understand is why when calculating the 'discounted price’ you have to subtract 1?

Re: Help with some python homework...

2014-02-02 Thread Denis McMahon
On Sun, 02 Feb 2014 08:57:03 -0800, David Hutto wrote: Revised: discounted_price = price_per_book - (price_per_book * percent_discount) by applying some simple algebra to the right hand side price_per_book - (price_per_book * percent_discount) x = (x * 1) so price_per_book ==

Re: Help with some python homework...

2014-02-02 Thread David Hutto
On Sunday, February 2, 2014 12:43:01 PM UTC-5, Denis McMahon wrote: On Sun, 02 Feb 2014 08:57:03 -0800, David Hutto wrote: Revised: discounted_price = price_per_book - (price_per_book * percent_discount) by applying some simple algebra to the right hand side

Re: Help with some python homework...

2014-02-02 Thread David Hutto
Or a better iterating example for a database of shipping, or ordering books would be: import random as r def order_total(price_per_book,percent_discount_amount,quantity,first_book_shipping,extra_book_shipping): percent_discount = price_per_book * percent_discount_amount

Re: Help with some python homework...

2014-02-02 Thread David Hutto
Should have been the following, which just shows the books price as a float as well, but you get the point by now, I'm sure: import random as r def order_total(price_per_book,percent_discount_amount,quantity,first_book_shipping,extra_book_shipping): percent_discount = price_per_book *

Re: Help with some python homework...

2014-02-02 Thread David Hutto
On Saturday, February 1, 2014 2:32:22 PM UTC-5, Denis McMahon wrote: On Fri, 31 Jan 2014 18:14:31 -0700, Scott W Dunning wrote: little different from a few things you guys had mentioned. For one, I got the correct time by calculating the number of time run and converting that

Re: Help with some python homework...

2014-02-02 Thread Larry Hudson
On 02/02/2014 05:12 PM, David Hutto wrote: snip A little OT, but these might peak your interest for this: Also a little OT, but the word you're looking for is spelled pique. ;-) (Although, it IS pronounced 'peak'.) -=- Larry -=- -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with some python homework...

2014-02-01 Thread David
On 1 February 2014 14:17, David bouncingc...@gmail.com wrote: Scott's message quoted above did not reach me, only Chris's quote of it, so I say: Scott once you begin a discussion on a mailing list like this one, please make sure that every reply you make goes to python-list@python.org and not

Re: Help with some python homework...

2014-02-01 Thread Denis McMahon
On Fri, 31 Jan 2014 18:14:31 -0700, Scott W Dunning wrote: little different from a few things you guys had mentioned. For one, I got the correct time by calculating the number of time run and converting that into seconds then back out to hr:mn:sc. I didn’t calculate from midnight. SECONDS

Re: Help with some python homework...

2014-02-01 Thread Denis McMahon
On Fri, 31 Jan 2014 22:18:34 -0700, Scott W Dunning wrote: Any chance you guys could help with another question I have? Below is a code to a different problem. The only thing I don’t understand is why when calculating the 'discounted price’ you have to subtract 1? Thanks again guys!

Re: Help with some python homework...

2014-02-01 Thread Scott W Dunning
Yeah you’re right I didn’t even notice that. For some reason I just added the 60 instead of using quantity which had been defined. On Feb 1, 2014, at 8:50 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Fri, 31 Jan 2014 22:18:34 -0700, Scott W Dunning swdunn...@cox.net declaimed the

Re: Help with some python homework...

2014-01-31 Thread Gregory Ewing
sjud9227 wrote: Doesn't assigning seconds/(60*60) mean that calculating 6*hours will give me 6 hours in seconds? No, it's giving you 6 seconds in hours. (That should give you a clue as to what you should have done instead. :-) Also, I don't know what you were trying to do with these two

Re: Help with some python homework...

2014-01-31 Thread Chris Angelico
On Fri, Jan 31, 2014 at 7:17 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: sjud9227 wrote: Doesn't assigning seconds/(60*60) mean that calculating 6*hours will give me 6 hours in seconds? No, it's giving you 6 seconds in hours. (That should give you a clue as to what you should

Re: Help with some python homework...

2014-01-31 Thread Gregory Ewing
Chris Angelico wrote: OP is using 2.7.6, so short of a __future__ directive, that won't actually give 6 seconds in hours Oops, yes, you're right! (I always use future division these days, so I tend to forget about that.) and // is unnecessary. It's still a good habit to get into, though,

Re: Help with some python homework...

2014-01-31 Thread Neil Cerutti
On 2014-01-31, scottw...@gmail.com scottw...@gmail.com wrote: Here is the question that was asked and below that I'll paste the code I have so far. **If I leave my house at 6:52 am and run 1 mile at an easy pace (8:15 per mile), then 3 miles at tempo (7:12 per mile) and 1 mile at easy pace

Re: Help with some python homework...

2014-01-31 Thread Chris Angelico
On Sat, Feb 1, 2014 at 11:42 AM, Scott W Dunning swdunn...@cox.net wrote: Also, any help on how to get the hours and seconds into double digits that would be cool too. 00:00:00 Once you can divide the number of seconds into hours, minutes, and seconds, you can format them like this: time =

Re: Help with some python homework...

2014-01-31 Thread Chris Angelico
On Sat, Feb 1, 2014 at 12:14 PM, Scott W Dunning swdunn...@cox.net wrote: Thanks Chris! Also, before I forget what is the difference between / and //? I remember something about floor division? In Python 2, the / operator by default is floor division. 5 divided by 2 is 2. When you divide

Re: Help with some python homework...

2014-01-31 Thread Denis McMahon
On Thu, 30 Jan 2014 21:12:19 -0800, scottwd80 wrote: Here is the question that was asked and below that I'll paste the code I have so far. The following is a reasonably but not highly obfuscated short solution to the problem set in python 2.7. With a bit of luck, after each lesson of your

Re: Help with some python homework...

2014-01-31 Thread David
On 1 February 2014 12:34, Chris Angelico ros...@gmail.com wrote: On Sat, Feb 1, 2014 at 12:14 PM, Scott W Dunning swdunn...@cox.net wrote: Also, I think I found out through a little trial and error that I had two different hours, mins, and sec so I had to use one uppercase and one lower

Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
So, this is what I came up with. It works, which is good but it’s a little different from a few things you guys had mentioned. For one, I got the correct time by calculating the number of time run and converting that into seconds then back out to hr:mn:sc. I didn’t calculate from midnight.

Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
You guys are awesome! I think I was over complicating things for one. Plus I was looking at some code I wrote for another problem that asked to put in the number of seconds to calculate the problem and I didn’t need some of the things I added to this problem. Anyways, you guys have given me

Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
Also, can any of you reccommend sites that may have little “projects” that I could work on to help me learn python better? On Jan 31, 2014, at 1:30 AM, Chris Angelico ros...@gmail.com wrote: On Fri, Jan 31, 2014 at 7:17 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: sjud9227 wrote:

Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
Also, any help on how to get the hours and seconds into double digits that would be cool too. 00:00:00 On Jan 31, 2014, at 1:30 AM, Chris Angelico ros...@gmail.com wrote: On Fri, Jan 31, 2014 at 7:17 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: sjud9227 wrote: Doesn't assigning

Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
If you’re interested in what the problem is here it is… Suppose the cover price of a book is $24.95, but bookstores get a 40% discount. Shipping costs $3 for the first copy and 75 cents for each additional copy. What is the total wholesale cost for 60 copies? On Jan 31, 2014, at 10:18 PM,

Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
Thanks Chris! So, this is what I came up with. It works, which is good but it’s a little different from a few things you guys had mentioned. For one, I got the correct time by calculating the number of time run and converting that into seconds then back out to hr:mn:sc. I didn’t calculate

Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
Ok cool, thanks Denis! On Jan 31, 2014, at 8:02 PM, Denis McMahon denismfmcma...@gmail.com wrote: On Thu, 30 Jan 2014 21:12:19 -0800, scottwd80 wrote: Here is the question that was asked and below that I'll paste the code I have so far. The following is a reasonably but not highly

Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
Any chance you guys could help with another question I have? Below is a code to a different problem. The only thing I don’t understand is why when calculating the 'discounted price’ you have to subtract 1? Thanks again guys! price_per_book = 24.95 discount = .40 quantity = 60

Help with some python homework...

2014-01-30 Thread scottwd80
Here is the question that was asked and below that I'll paste the code I have so far. Any pointers would be great. Please keep in mind this is only my second week with python (or any programming for that matter) so I have no idea what I'm doing. How would you code this? Anyways, any help is

Re: Help with some python homework...

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 4:12 PM, scottw...@gmail.com wrote: **If I leave my house at 6:52 am and run 1 mile at an easy pace (8:15 per mile), then 3 miles at tempo (7:12 per mile) and 1 mile at easy pace again, what time do I get home for breakfast?** seconds = 1 hours =

Re: Help with some python homework...

2014-01-30 Thread sjud9227
On Thursday, January 30, 2014 10:30:11 PM UTC-7, Chris Angelico wrote: On Fri, Jan 31, 2014 at 4:12 PM, scottw...@gmail.com wrote: **If I leave my house at 6:52 am and run 1 mile at an easy pace (8:15 per mile), then 3 miles at tempo (7:12 per mile) and 1 mile at easy pace again, what

Re: Help with some python homework...

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 5:24 PM, sjud9227 scottw...@gmail.com wrote: Thank you so much Chris. However, i'm still a little confused. Doesn't assigning seconds/(60*60) mean that calculating 6*hours will give me 6 hours in seconds? Also, why calculate how many seconds from midnight? wouldn't

Re: Help with some python homework...

2014-01-30 Thread sjud9227
On Thursday, January 30, 2014 11:38:05 PM UTC-7, Chris Angelico wrote: On Fri, Jan 31, 2014 at 5:24 PM, sjud9227 scottw...@gmail.com wrote: Thank you so much Chris. However, i'm still a little confused. Doesn't assigning seconds/(60*60) mean that calculating 6*hours will give me 6