# Purpose: Tax input amount
#          
#-----------------------------------------------------------------------
# VARIABLE DEFINITIONS
salesAmount= 0.0
salesTax=0.0
total=0.0
#-----------------------------------------------------------------------
# CONSTANT DEFINITIONS

#-----------------------------------------------------------------------
# FUNCTION DEFINITIONS

#-----------------------------------------------------------------------
# PROGRAM'S MAIN LOGIC
salesAmount = float (raw_input("Enter the sales amount:"))
salesTax = float(salesAmount*0.08)   
total = salesAmount + salesTax 

print "The sales amount is $", salesAmount
print "The sales tax is $",salesTax
print "The total sale is $",total 


raw_input("\nRun complete. Press the Enter key to exit.")

Recommended Answers

All 4 Replies

i know you have to add \n but ive tried putting it everywhere

print "The sales amount is $\n\n", salesAmount
or
print "The sales amount is $", 2*'\n', salesAmount

print(2*'\n')

at line 19 before results.

Or change the line 20

print "\n\nThe sales amount is $", salesAmount

You can aslo use the WYSIWYG approach to format your output ...

# Purpose: Tax input amount
#          
#-----------------------------------------------------------------------
# VARIABLE DEFINITIONS

#-----------------------------------------------------------------------
# CONSTANT DEFINITIONS

#-----------------------------------------------------------------------
# FUNCTION DEFINITIONS

#-----------------------------------------------------------------------
# PROGRAM'S MAIN LOGIC
salesAmount = float (raw_input("Enter the sales amount: "))
salesTax = salesAmount*0.08   
total = salesAmount + salesTax 

# create a formatted result string with % modifiers
# %0.2f --> formats float to 2 decimals
# what you see is what you get (WYSIWYG)
sf = """\


The sales amount is $%0.2f
The sales tax is $%0.2f
The total sale is $%0.2f

"""
print sf % (salesAmount, salesTax, total)

raw_input("Run complete. Press the Enter key to exit.")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.