Write the output of the following : import statisticsĬ. Write the output of the following import math Write the output of the following : import math Random Module : Click here for notes and questions mode( ) : This function returns the mode ie a number with maximum number of occurrence. mean( ) : This function returns the average of the data passed as an argument. median( ) : This function returns the median of the data. Statistics Module : Functions of statistics module are discussed below:Ī. e : It returns the mathematical constant import math Output : 1.6197751905438615 NOTE : Value passed in this function should be in radian. tan( ) : This function returns the tangent of value passed as argument. Output : 0.5253219888177297 NOTE : Value passed in this function should be in radian. cos( ) : This function returns the cosine of value passed as argument. Output : 0.8509035245341184 NOTE : Value passed in this function should be in radian Introduction to Python Modules sin( ) : This function returns the sine of value passed as argument. pow(m, n) : This function returns m raise to the power n. ceil(n) : This function returns the smallest integer which is more than or equal to n. Print(math.floor(23.96) Output : 23 Introduction to Python Modulesī. floor(n) : This function returns the largest integer which is less than or equal to n. Let we discuss few functions of math module.Ī. Math module : This module has many mathematical functions like ceil, floor, sqrt etc. Some of the common built-in modules are:ġ. Built-in Modules : There are many built in modules in Python Library. Using import* statement : This statement can be used to import all functions of a specific module likeġ. To import more than one function of a module, we can writeģ. Using ‘from’ statement : This method allow us to import specific function of a module. To use more than one module like math and random in our code, we can write :Īfter importing module in our code, we can access a specific function by writing:Ģ. for example : to use math module, we can write. This method allow us to access all the functions/objects defined in the module. Using import statement : This is one of the most common way to use module in Python. There are three ways to import a module in Python.ġ. Introduction to Python Modules Importing Python modules
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |