Skip to content

This repository contains Python programs that demonstrate the use of functions and the math module. Task 1 defines a factorial function to calculate and return the factorial of a number. Task 2 uses the math module to compute the square root, natural logarithm, and sine of a user-provided number.

Notifications You must be signed in to change notification settings

KhatijaK05/Functions-and-Modules-in-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Functions-and-Modules-in-Python

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

  1. Defining and calling functions.
  2. Using recursion or loops for factorial calculation.
  3. Importing and applying Python’s math module.
  4. Handling user inputs and displaying outputs.

Learning Outcomes -> By working with these programs, learners will:

  1. Strengthen their understanding of functions in Python.
  2. Learn how to use Python’s math library effectively.
  3. Practice problem-solving with real-world mathematical examples.

About

This repository contains Python programs that demonstrate the use of functions and the math module. Task 1 defines a factorial function to calculate and return the factorial of a number. Task 2 uses the math module to compute the square root, natural logarithm, and sine of a user-provided number.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages