Practice Lab 1 - Introduction To Python
Practice Lab 1 - Introduction To Python
𝟏 𝟐
𝒀= 𝒆−𝟎.𝟓𝑿
√𝟐𝝅
a) Write a function ‘def gauss(x)’ to read a value of X and compute the corresponding value
of Y. For best results choose x between 0 and 1. Output should look like
““The standard normal density function evaluated at x.xx gives a value of xx.xxxx””
b) Modify the above program by taking “x” as an input from the user using the “input()”
syntax and the output again should look like as given above. Remember in python the
input statement takes in anything as a “string” which has to be converted into a float or
an integer. For best results choose x between 0 and 1.
Note: remember to use exponent, import math and then use math.exp() to get the exponent value.
Easiest way to do is solve the exponent term separately and assign it to a variable which can be
used for further calculations.
************************************************************************************************
Page 2 of 2
NB