Module 4: Functions & Modules in Python (Assignment 3)
ASSIGNMENT 3: Module 4: Functions & Modules in Python Task 1: Calculate Factorial Using a Function
Problem Statement: Write a Python program that:
- Defines a function named factorial that takes a number as an argument and calculates its factorial using a loop or recursion.
- Returns the calculated factorial.
- Calls the function with a sample number and prints the output.
Expected Output: For example, if the function is called with 5, it should return:
Task 2: Using the Math Module for Calculations
Problem Statement: Write a Python program that:
- Asks the user for a number as input.
- Uses the math module to calculate the: o Square root of the number o Natural logarithm (log base e) of the number o Sine of the number (in radians)
- Displays the calculated results. Expected Output: For example, if the user enters 25, the output should be:
Submission Instructions: Create a GitHub repository and upload your Python scripts (.py files). Ensure the repository includes a README.md file that describes the functionality of your programs. Add both Task 1 and Task 2 scripts in the same repository. Submit the link to your GitHub repository once uploaded.
Reference: Follow the Python course - Module 4: Functions & Modules in Python for additional guidelines and examples.
Note: Please test your project thoroughly and check all the validations and error handling prior to ensure it works as expected before submission.