Thinkpython书籍练习

时间:2017-03-12 20:59:46

标签: python

price_book = 24.95
number_books = 60.0/100
first_book_cost = 3
additional_copy = 0.75
discounted_books = price_book*number_books
total_price = discounted_books*(first_book_cost*1+additional_copy*(60-1))

print "The total price of 60 copies of book is %s$."%(total_price)

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?

有人可以告诉我,我做错了什么!! 答案应该是523.23,我得到707.33! 提前谢谢!

2 个答案:

答案 0 :(得分:0)

这里的问题不是很明确。

他们是否可以获得订单总额/图书费用等40%的折扣?

我模仿了我的想法,但我无法接近523.23。

事实上,所有书籍的40%折扣为14.97 * 60,在运费之前达到898.20。

public interface IJournalEntry<T>
{
}

public class Journal
{
    public IJournalEntry<T> NewJournalEntry<T>()
    {
        return new JournalEntry<T>();
    }

    public Journal() { }

    private class JournalEntry<T> : IJournalEntry<T>
    {
        public JournalEntry()
        {

        }
    }
}

答案 1 :(得分:0)

有时书籍,尤其是免费书籍,会出现拼写错误。

根据您提供的信息,总批发费用应为:

>>> cover_price_of_book = 24.95
>>> shipping_cost_for_first_book = 3.00
>>> shipping_cost_for_additional_books = 0.75
>>> wholesale_cost_of_book = 24.95 * .60
>>> total_number_of_books = 60
>>> total_wholesale_cost = (wholesale_cost_of_book * total_number_of_books) + (shipping_cost_for_first_book + (total_number_of_books - 1) * shipping_cost_for_additional_books)
total_wholesale_cost
945.4499999999