Need help with writing an algorithm:

Department Store Sale! Prompt the user to enter the sticker price of each of the clothing items they’re purchasing (make sure all input prices are positive). The user should be allowed to purchase as many items as he or she would like. For each individual item, the user should input whether the item is a White Tag (regular price), Blue Tag (25% off), Orange Tag (50% off), or Red Tag (75% off) item. Output the final bill, including tax.

I'm new to this.

Main ()
         Declare Tax_Price as Real
         Declare Final_Price as Real
         Declare Discount as Real
         Declare Item_Price as Real
         Display “Please enter the item price”
         Input Item_Price
         Display “Please enter discount as decimal”

Edited by pyTony: Edit format

2 Years
Discussion Span
Last Post by sneekula

In Python you don't declare variables.
To read an input value, and supposing you use Python2, try the following at the interactive prompt:

price = input("Give price: ")
print price

(entering a value when pompted). This should give you an idea. If you want to read string values rather than numbers, use raw_input.

If you are useing Python3, then do something like:

price = input("Give price: ")
price = float(price)

You can use input() for both versions of Python:

# Python2 uses raw_input() for strings
# Python3 uses input() for strings

# ----------------------------------------------
# add these few lines near the start of you code
import sys
# make string input work with Python2 or Python3
if sys.version_info[0] < 3:
    input = raw_input
# ----------------------------------------------

# test ...
# now you can avoid using raw_input()
name = input("Enter your name: ")
# if you expect float input, use float() instead of int()
age = int(input("Enter your age: "))
print("%s you are %d old" % (name, age))
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.