Skip to content

Nagasaida1/Functions-Modules_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Functions-Modules_Python

Overview

This repository contains two Python programs that demonstrate the use of functions and modules:

  1. Task 1: Calculate Factorial Using a Function
  2. Task 2: Using the Math Module for Calculations

Each program takes user input, performs computations, and displays the expected output.


Task 1: Calculate Factorial Using a Function

Filename: Task1.py

Description

This program calculates the factorial of a given number using a recursive function. It takes an integer input from the user, computes the factorial, and displays the result.

Usage

  • Run the script and enter an integer when prompted.
  • The program will return and display the factorial of the entered number.

Example Output

Enter a number: 5
Factorial of 5 is: 120

Task 2: Using the Math Module for Calculations

Filename: Task2.py

Description

This program demonstrates the use of Python’s built-in math module to perform mathematical calculations. It takes a numerical input from the user and computes:

  • The square root of the number.
  • The logarithm.
  • The sine.

Usage

  • Run the script and enter a number when prompted.
  • The program will display the calculated results for square root, logarithm, and sine.

Example Output

Enter a number: 25
Square root : 5.0
logarithm : 3.2188758248682006
Sine : -0.13235175009777303

How to Run the Programs

  1. Ensure Python 3.x is installed on your system.

  2. Clone this repository or download the files.

  3. Open a terminal/command prompt and navigate to the directory where the files are located.

  4. Run the programs using the following commands:

    • For Task 1:
      python Task1.py
      
    • For Task 2:
      python Task2.py
      

Requirements

  • Python 3.x
  • No external libraries required (uses built-in math module for Task 2).

Contributing

Contributions and improvements are welcome! Feel free to modify the code and experiment with different approaches.


License

This project is open-source and free to use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages