How to make a program to calculate tax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • depasqualen
    New Member
    • Jan 2015
    • 6

    #1

    How to make a program to calculate tax

    I'm trying to make a python program that

    1) prompts the user to enter the value of the sale with the following statement:
    “Enter the value of the company’s sales in dollars in August 2013:”

    2)The sale value should be stored in a variable of type float

    3)Compute the sales tax based on 6% of the sale

    4) Print the resulting sales tax in the following format:
    “The sales tax is $ for August 2013 ”

    This is the code I currently have
    Code:
    salevalue = int(input("Enter the value of the company's sales in dollars in August 2013"))
    
    saletax = float(salevalue*0.06)
    
    print("The sales tax is" + saletax + "for August 2013")
    I am very new to programming in python so I really have no idea where to go from here. Thanks for reading :)
    Last edited by bvdet; Jan 26 '15, 10:34 PM. Reason: Please use code tags when posting code [code]....[/code]
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    To print the result, you can use the format method.
    Code:
    >>> saletax = float(256753*0.06)
    >>> print("The sales tax is ${s:.2f} for August 2013".format(s=saletax))
    The sales tax is $15405.18 for August 2013
    >>>

    Comment

    Working...