In this python function program, we will create a Fruitshop Management system using function.
What is Function?
It is a block of code that executes when it is called.
To create a function use def keyword.
Steps to solve the program
- Create a function fruit.
- Use the def keyword to define the function.
- Pass three parameters i.e. fruit name, fruit price, and fruit quantity.
- Print the fruit name, fruit price, and fruit quantity.
- Calculate the total bill by multiplying fruit price and fruit quantity.
- Print the bill.
- Pass the fruit name, fruit price, and fruit quantity to the function while calling the function.
def fruit(fname,fprice,quantity):
print("Fruit name: ",fname)
print("Fruit price: ",fprice)
print("Fruit quantity in kg: ",quantity)
print("Bill : ",fprice*quantity)
fruit("Apple",100,2)
Output :
Fruit name: Apple
Fruit price: 100
Fruit quantity in kg: 2
Bill : 200
Related Articles
Python function program to check whether the given year is a leap year.
Python function program to reverse an integer.
Python function program to create a library management system.
Python function program to add two Binary numbers.
Python function program to search words in a string.
Python function program to get the length of the last word in a string.