Python Functions for Beginners | Parameters, Return and Reuse | Lecture 08
Beginner-level Programming video in Tamil by Programming Line, 6 minutes long, published 6 Oct 2026.
Put an expense-total calculation into a reusable Python function. Define a parameter, supply a list as an argument, and return a result. Then compare return with print and reuse the same function with two records, no records, and a small practice list. You will learn: - How def creates a function - How a parameter receives an argument - Why return belongs outside this for loop - Why defining a function alone prints nothing - How return differs from print - How the same calculation handles an empty list The example uses fictional categories and whole-rupee amounts. The final program displays totals of 165, 0, 80 and 100. CHAPTERS 00:00 Welcome to reusable functions 00:23 Define the function and parameter 00:47 Loop and return the total 01:12 Predict a definition-only run 01:23 Run the definition without a call 01:45 Supply the two expense records 02:30 Run and inspect the returned total 02:44 Separate return from print 03:13 Check the direct call inside print 03:25 Call with an empty list and predict 03:48 Check the empty-list result 04:04 Your turn 04:28 Add and run the exercise extension 05:25 Check both practice totals 05:39 Recap and next lesson NEXT LESSON Read a real error message and handle predictable invalid input. Official reference: https://docs.python.org/3.12/tutorial/controlflow.html#defining-functions Programming Line | Python for Absolute Beginners Narration: Simran, an AI-generated voice. The lesson uses genuine screen-recorded Python demonstrations. #Python #PythonForBeginners #ProgrammingLine…more
Put an expense-total calculation into a reusable Python function. Define a parameter, supply a list as an argument, and return a result. Then compare return with print and reuse the same function with two records, no records, and a small practice list. You will learn: - How def creates a function - How a parameter receives an argument - Why return belongs outside this for loop - Why defining a function alone prints nothing - How return differs from print - How the same calculation handles an empty list The example uses fictional categories and whole-rupee amounts. The final program displays totals of 165, 0, 80 and 100. CHAPTERS 00:00 Welcome to reusable functions 00:23 Define the function and parameter 00:47 Loop and return the total 01:12 Predict a definition-only run 01:23 Run the definition without a call 01:45 Supply the two expense records 02:30 Run and inspect the returned total 02:44 Separate return from print 03:13 Check the direct call inside print 03:25 Call with an empty list and predict 03:48 Check the empty-list result 04:04 Your turn 04:28 Add and run the exercise extension 05:25 Check both practice totals 05:39 Recap and next lesson NEXT LESSON Read a real error message and handle predictable invalid input. Official reference: https://docs.python.org/3.12/tutorial/controlflow.html#defining-functions Programming Line | Python for Absolute Beginners Narration: Simran, an AI-generated voice. The lesson uses genuine screen-recorded Python demonstrations. #Python #PythonForBeginners #ProgrammingLine