A function is a block of organized, reusable code that is used to perform a single, related action.
Functions provide better modularity for your application and a high degree of code reusing.
def functionname( parameters ): "function_docstring" function_suite return [expression]
Program code:
Clear Doubts with Computer TutorIn case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in
Output:
Enter feet : 10 Number of inches : 120
Three functions are defined for conversion of feet to inches, Taking input of feet from user and displaying function which displays the accurate inches after conversion respectively.
The user input is passed as argument to conversion function and result of conversion is then displayed.
Basic python functionality is demonstrated in above program.
To view all the lessons in chapter 1: http://computertutor.in/class-12-computer-science/chapter-1/
To view entire class 12 computer science study material: http://computertutor.in/resources/
You cannot copy content of this page