Preview:
#Question 5

price = float(input("Enter item price: "))
tag_colour = input("Enter tag colour: ")
discount = 0

if tag_colour == "yellow":
    discount = 0.25
elif tag_colour == "red":
    discount = 0.5
elif tag_colour == "blue":
    discount = 0.7

mcard = input("Do you have member card? (y/n): ")

if mcard == "y":
    discount += 0.05

final_price = price * (1 - discount)

print("Total discount =", discount * 100, "%")
print("Final price = RM", final_price)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter