Functions and Math Module This repository contains Python programs demonstrating the use of functions and the math module. The tasks showcase how to build reusable code and perform mathematical computations in Python
Tasks Implemented Task 1: Calculate Factorial Using a Function -> Defines a function factorial that takes a number as input. -> Calculates the factorial using either a loop or recursion. -> Returns the calculated factorial. -> Calls the function with a sample number and displays the result.
Task 2: Using the Math Module for Calculations -> Asks the user to input a number. -> Uses the math module to calculate: ->Square root of the number ->Natural logarithm (log base e) of the number ->Sine of the number (in radians) -> Displays the results neatly.
Concepts Covered
- Defining and calling functions.
- Using recursion or loops for factorial calculation.
- Importing and applying Python’s math module.
- Handling user inputs and displaying outputs.
Learning Outcomes -> By working with these programs, learners will:
- Strengthen their understanding of functions in Python.
- Learn how to use Python’s math library effectively.
- Practice problem-solving with real-world mathematical examples.