These free B.Pharm notes on python functions arguments and return values cover chapter 8 of Basics of Python Programming for Pharmaceutical Sciences (BP101T), a first-semester subject. Read the key points below, then study the complete chapter PDF. You can browse every chapter in the Basics of Python Programming for Pharmaceutical Sciences category.
Table of Contents
Read the following document for full information
Overview of python functions arguments and return values
These notes explain what functions are and how they break a program into small reusable parts. They cover defining a function with def, calling a function, why functions are used, functions with parameters and with return values, pharmacy examples on drug information and total dosage, and then passing arguments as positional, keyword and default arguments, followed by returning values.
Key points on python functions arguments and return values
- A function is defined with the def keyword, and its statements run only when the function is called, not at the time it is defined.
- Functions are used for reusability, keeping programs short and organised, saving time and making errors easier to fix in one place.
- A parameter is a placeholder variable named in the function definition, while an argument is the actual value supplied when the function is called.
- Positional arguments are matched by their order, keyword arguments are passed by naming the parameter, and default arguments are used when no value is supplied.
- The return statement sends a result back to the caller and stops the function immediately; a function without return automatically returns None.
Relevance to pharmacy practice
Functions let a pharmacist write a dosage or drug information routine once and reuse it for many drugs and patients, such as adding the doses of two drugs. Passing different arguments to the same function gives correct results for each case without rewriting the code.
Every chapter in this subject builds on the one before it, so do not skip topics that look simple. Definitions, principles, procedures and examples are the parts that examiners return to most often, and a clear understanding here will also make later subjects easier to follow in the coming semesters.
Frequently asked questions on python functions arguments and return values
What is the difference between a parameter and an argument?
A parameter is the placeholder variable named in the function definition, such as name in def greet(name). An argument is the real value passed during the call, such as “Asha” in greet(“Asha”).
What does a Python function return if there is no return statement?
If a function does not contain a return statement, Python automatically makes it return the value None. The return statement is what sends a result back to the caller.
What is the difference between print and return in a function?
Using print only displays a value on the screen, while return gives the value back to the caller so that it can be stored in a variable and used further in the program.
Quick revision checklist
Use this self-test after reading the chapter on python functions arguments and return values. If you can do all of the following without looking at your notes, you are ready for the exam.
- I can explain: how to define a function with def
- I can explain: how to call a function
- I can explain: the difference between parameters and arguments
- I can explain: positional, keyword and default arguments
- I can explain: how the return statement works
Study and exam tips
Start by reading the chapter once for the overall idea, then revise python functions arguments and return values using headings, definitions, principles, reactions and examples. Short-answer questions in the university exam usually ask for definitions, principles, procedures, reactions and uses, so write these in your own words and practise the equations, tables and flow charts that the chapter has.
For wider reading, standard books and open resources such as the NCBI Bookshelf help you confirm terms and see more examples. Revise python functions arguments and return values again a day later and again a week later, because spaced revision improves long-term memory.
This page is part of the Basics of Python Programming for Pharmaceutical Sciences series for first-semester B.Pharm students on B.Pharm Guru, where every chapter has a short summary and a full PDF. Bookmark this page and share it with classmates who are preparing for the same exam.
Related notes: 10. LISTS, TUPLES, AND DICTIONARIES, 11. INDEXING AND SLICING LISTS, BASIC OPERATIONS ON LISTS AND DICTIONARIES, STRING MANIPULATION TECHNIQUES.
Next: 9. MODULAR PROGRAMS FOR PHARMACEUTICAL APPLICATIONS – DOSAGE AND BMI CALCULATION. Back to the Basics of Python Programming for Pharmaceutical Sciences category.




