On 1 Oct 2012 19:58, "Mark Rourke" <mark.rour...@gmail.com> wrote: > > hello, I am a college student in my first year of computer programming, I was > wondering if you could look at my code to see whats wrong with it. > > # Mark Rourke > # Sept 29, 2012 > # Write a program to calculate the sales tax at the rate of 4% and 2% > respectively > # Thereafter compute the total sales tax (sum of the state tax and the county > tax) > # and the total purchase amount (sum of the purchase amount and the total > sales tax).
<snip> > SALES_TAX = 0.4 > > COUNTY_TAX = 0.02 <snip> > purchaseAmount = input("Please input the Purchase Amount: $") > > #Calculate the State Sales Tax, County Sales Tax, Total Sales Tax, Total > Purchase Amount > > purchaseAmount = int(purchaseAmount) > > stateSalesTax = int(purchaseAmount * SALES_TAX) <snip> Hi Mark, c smith is certainly right to suggest that you ought to specify a bit more about what the symptoms are that you would like help diagnosing. That said, what should be the result if an item with a sticker price of 1.35 is purchased? Perhaps thinking about that and comparing the following will help: IDLE 2.6.6 >>> user_input = "1.35" >>> purchaseAmount = int(user_input) Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> purchaseAmount = int(user_input) ValueError: invalid literal for int() with base 10: '1.35' >>> user_input = float("1.35") >>> purchaseAmount = int(user_input) >>> purchaseAmount 1 >>> Best, Brian vdB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor