Page 123 - Plus V4 with Adobe class 6
P. 123

The print() Function

            The  print()  function  prints  or sends  the  output  to  the  standard  output  device,  which  is  usually
            a monitor. This function auto converts the items to strings, i.e., if you try printing a numeric value,
            the print() function will automatically convert it into equivalent string and print it. The print() function
            also introduces spaces between items automatically.

            The general syntax of the print() function is as follows:

            print [<expression 1> , <expression 2>...]
            For example:

            print ("Python is easy").

            Let's create a program to use the input( ) and print( ) functions.


















                                                                                      21 st
                     Double Tap                                                     Century   #Critical Thinking
                                                                                      Skills

                   Guess my name.
                   1. I am a free and open-source programming language.
                   2. I am a command line shell which gives immediate result for each command.

                   3. I save the commands entered by the user in the form of a program.
                   4. I am an option to save the Python program.
                   5. I am an option to run the Python program.



                 VARIABLES IN PYTHON


            Variables are memory reference points where we store values which can be accessed or changed
            later. The names given to the variables are known as identifiers. In Python, we do not need to specify
            the type of variable because Python is a dynamically typed language and it identifies the variable type
            automatically. Let’s understand this with the help of the given examples.


              num = 0.4
              _price = 30.3
              TOTAL = round(_price * num,2)

              print(TOTAL)



                                                                                                     #Python 121
   118   119   120   121   122   123   124   125   126   127   128