Page 447 - CITS - Computer Software Application -TT
P. 447

COMPUTER SOFTWARE APPLICATION - CITS




             Tick
           In Python, the time instants are counted since 12 AM, 1st January 1970. The function time() of the module time
           returns the total number of ticks spent since 12 AM, 1st January 1970. A tick can be seen as the smallest unit to
           measure the time.
           Consider the following example
           1  import time;
           2  #prints the number of ticks spent since 12 AM, 1st January 1970

           3  print(time.time())
           Output:
           1585928913.6519969

           How to get the current time?
           The localtime() functions of the time module are used to get the current time tuple. Consider the following exam.

           Python Math
           Python Math Module

           Introduction
           In this article, we are discussing Math Module in Python. We can easily calculate many mathematical calculations
           in Python using the Math module. Mathematical calculations may occasionally be required when dealing with
           specific fiscal or rigorous scientific tasks. Python has a math module that can handle these complex calculations.
           The functions in the math module can perform simple mathematical calculations like addition (+) and subtraction
           (-) and advanced mathematical calculations like trigonometric operations and logarithmic operations.
           This tutorial teaches us about applying the math module from fundamentals to more advanced concepts with
           the support of easy examples to understand the concepts fully. We have included the list of all built-in functions
           defined in this module for better understanding.
           What is Math Module in Python?
           Python has a built-in math module. It is a standard module, so we do not need to install it separately. We only
           must import it into the program we want to use. We can import the module, like any other module of Python, using
           import math to implement the functions to perform mathematical operations.
           Since the source code of this module is in the C language, it provides access to the functionalities of the underlying
           C library. Here we have given some basic examples of the Math module in Python. The examples are written
           below -
           Program Code 1:
           Here we give an example of a math module in Python for calculating the square root of a number. The code is
           given below -
           1  # This program will show the calculation of square root using the math module
           2  # importing the math module
           3  import math

           4  print(math.sqrt( 9 ))
           Output:
           Now we compile the above code in Python, and after successful compilation, we run it. Then the output is given
           below -

           3.0







                                                           434

                             CITS : IT&ITES - Computer Software Application - Lesson 120 - 137
   442   443   444   445   446   447   448   449   450   451   452