python - I am getting an unexpected character after line continuation character error -
I am getting an unexpected character after line continuity character error in this line
Print ("$ D $$$", \ "$ D $ $ $ $ \", format "(total $"), format (total, "10.2"), \ n \ t, "discount $", format (Disk, "10.2"), \ n \ t, cause, "10.2"), sep = "")
Can anyone tell me what it means and how it Decide? Thanks
def finddiscount (quantity): if quantity & gt; = 1 more volume & lt; = 9: discount = 0 elif volume> gt; = 10 more quantity & lt; = 1: discount = .2 Elif volume & gt; = 20 more quantity & lt; = 49: discount = .30 elif volume> = 50 more volume < = 99: discount = .40 elif quantity & gt; = 100: discount = .50 DEF (quantity, price): disk = (value * quantity) * search (quantity) total = (value * quantity) reason = (value * quantity) - (value * quantity) * dicount print ( "Discount $ $", format ("10.2"), format ("10.2"), "$ 10.2", format (reason, "10.2"), SP = "", "10.2"), \ n \ t , Format (disk, "10.2"), \ n \ t, DEF main (): volume = int (input ("how many packages have been purchased?")) Value = float (input ("how much is each item?" )) Calisthenic (Quantity, Value) Main ()
You forgot to use quotation marks around many odds on this line:
print (" \ t "," total $ Order "," Order (total, "(" 10.2 ")," ($ 10.2 ")," ($ 10.2 ")," ($ 10.2 ")," \ "," "^ ^ ^
< / Pre>and the other way to format is to use
str.format
:print ("\ torder total $ {: 10.2} \ n \ TDiscount $ {: 10.2} \ n \ t $ AM $ $: 10.2}. Format (total, disk, reason))
Comments
Post a Comment