Followers

Wednesday, November 13, 2019

UNDERSTANDING PRINT( )

TO PRINT OR DISPLAY OUTPUT:-

To Print or Display Output, Python provides Print( ) Function. you can use Print( ) as 
        Print(<object to be printed>....)
E.g., when you wrote:
                             Print("HELLO WORLD")
Output :
            HELLO WORLD
Similarly, to print other strings you may give something like,
                             Print('My Name is Sourav')
Output :
             My Name is Sourav
Carefully notice at both the Print( ) statements given above. Could you notice anything other than two different string values?? NO ??
Carefully Notice that the First string is enclosed in Double Quotes and the second string is enclosed in Single quotes.

         Print("HELLO WORLD") 
         ↓
         ↳ STRING ENCLOSED IN DOUBLE QUOTES


         Print('My Name is Sourav')
         ↓
          ↳STRING ENCLOSED IN SINGLE QUOTES
Both these strings are valid in Python. You can enclose your strings in either Double quotes or in Single Quotes, but just ensure that opening and closing Quotation mark should be of same type. You cannot have a String Like,
                         'HELLO THERE"
or,                     Print("HELLO WORLD')
                         ↓    
                         ↳THESE ARE INVALID STRINGS 
Following are some valid string or Print( ) Statement,
        
            Print("CAPTAIN AMERICA")
            Print('HELLO WORLD')
            "Superman"
             'She is Beautiful'

So with this we are end with this Post.
JAI HIND!!! 
VANDE MATARAM!!!!!                         

No comments:

Post a Comment

If you have any doubts, please do let me Know.