Run a function · in code: Calling a Function
Runs one of your functions. The program steps into the function, runs its blocks, then comes back here and carries on.
total = addTax(100, 5).pet. Leave it empty for a plain function.addTax or feed.100, 5. Any maths works, like price * 2.total. Leave it empty if it gives nothing back.Open it in the editor, press Run, then change it and run it again.
def lineTotal(price, qty): cost = price * qty return cost
print("Stationery shop: pens ₹10 each, notebooks ₹45 each")pens = int(input("How many pens? "))pensCost = lineTotal(10, pens)books = int(input("How many notebooks? "))booksCost = lineTotal(45, books)total = pensCost + booksCostprint("Pens: ₹" + str(pensCost))print("Notebooks: ₹" + str(booksCost))print("Total to pay: ₹" + str(total))