Normal Distribution PDF Calculator

Medium
Deep Learning

Write a Python function to calculate the probability density function (PDF) of the normal distribution for a given value, mean, and standard deviation. The function should use the mathematical formula of the normal distribution to return the PDF value rounded to 5 decimal places.

Examples

Example 1:
Input: x = 16, mean = 15, std_dev = 2.04
Output: 0.17342
Explanation: The function computes the PDF using x = 16, mean = 15, and std_dev = 2.04.

Starter Code

import math

def normal_pdf(x, mean, std_dev):
	"""
	Calculate the probability density function (PDF) of the normal distribution.
	:param x: The value at which the PDF is evaluated.
	:param mean: The mean (μ) of the distribution.
	:param std_dev: The standard deviation (σ) of the distribution.
	"""
	# Your code here
	pass
	return round(val,5)
Lines: 1Characters: 0
Ready
The AI Interview - Master AI/ML Interviews