The function should ask the user for the price of the delivery and if the price is less than £10 then it should print a statement saying "the total price including the delivery charge is" + £1.50 or it should just output the normal price if it is more than or equal to £10 as the delivery would be free.

order=input("Please enter the price of the order: ")
x=1.50
if order <10:
    print"the total price including the delivery charge is", order + x
else:
    print"The toal price including delivery charges is", order

Is there a question somewhere?

Is there a question somewhere?

the code doesnt wrk properly... osrry i forgot to put the actual question... i mean the IF function so if u enter something below ten, it doesnt add the £1.50..

Strange, works fine for me. You do use Python2, do you?

You may want to put a console wait line at the end, something like ...

raw_input("Press Enter to go on ... ")

If you are using python 3 then you just have to change your input and print statements to fit

order=int(input("Please enter the price of the order: "))
x=1.50
if order <10:
    print("the total price including the delivery charge is", order + x)
else:
    print("The toal price including delivery charges is", order)

HTH :)

for some odd reason it seems to be working nw, but i can just add something. How can i add pounds to the last line?.. so when the user inputs 8 for example, the output should be the total price... is 8pounds or £8 and not just 8..

total price... is 8pounds or £8 and not just 8..

order = input("Please enter the price of the order: ")
x = 1.50
if order < 10:
    print "the total price including the delivery charge is %d pounds" % (order + x)
else:
    print "The toal price including delivery charges is %d pounds" % (order)
order = input("Please enter the price of the order: ")
x = 1.50
if order < 10:
    print "the total price including the delivery charge is %d pounds" % (order + x)
else:
    print "The toal price including delivery charges is %d pounds" % (order)

but using this code.. i get the total price as 9pounds when i input 8 pounds, or when i input 7pounds i get 8pounds and nt £8.50, but when i input something like 8.50 it gives 10pounds. when the number is a decimal is it fine and not when its a whole number.

Yes,i should have think of that you need floating point number to get correct sum.
%.2f(give you 2 decimal float number)

is %.2f pounds" % (order + x)

this is my current code, but when i input 10, i get 11.50 and not 10pounds. It has to be equal to or more than 10 for free delivery. I have tried using the <+ sign but still it doesn't seem to wrk?

def pizzaOrder():
    order = input("Please enter the price of the order: ")
    x = float(1.50)
    if order <= 10:
        print "the total price including the delivery charge is is %.2f pounds" % (order + x)
    else:
        print "The toal price including delivery charges is is %.2f pounds" % (order)

When you changed
if order < 10
to
if order <= 10
it will behave that way!

When you changed
if order < 10
to
if order <= 10
it will behave that way!

but it doesn't seem to be working... it still gives 11.50 when i input 10...

def pizzaOrder():
    order = input("Please enter the price of the order: ")
    x = float(1.50)
    if order <= 10:
        print "the total price including the delivery charge is is %.2f pounds" % (order + x)
    else:
        print "The toal price including delivery charges is is %.2f pounds" % (order)

but it doesn't seem to be working... it still gives 11.50 when i input 10...

Yes as it should do,is should not be so hard to understand.
<= 10 means that less than 10 or equal to 10 it will add 1.50.
Then off course if you input is 10 it will add 1.50 and print 11.50.
< 10 all values under 10 it will add 1.50

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.