๐•พ๐–™๐–—๐–Ž๐–“๐–Œ๐–˜ ๐–Ž๐–“ ๐–•๐–ž๐–™๐–๐–”๐–“ ๐–•๐–—๐–”๐–Œ๐–—๐–†๐–’๐–’๐–Ž๐–“๐–Œ

๐™Ž๐™๐™๐™„๐™‰๐™‚๐™Ž

           Strings in python are surrounded by either single quotes or double quotes. You can display a string literally with the print()  function. 

๐™€๐™ญ๐™–๐™ข๐™ฅ๐™ก๐™š : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


 ๐˜ผ๐™Ž๐™Ž๐™„๐™‚๐™‰ ๐˜ผ ๐™Ž๐™๐™๐™„๐™‰๐™‚๐™Ž ๐™๐™Š ๐˜ผ ๐™‘๐˜ผ๐™๐™„๐˜ผ๐˜ฝ๐™‡๐™€๐™Ž : 

                  Assigning a string to a variable is done with the variable name followed by an equal sign and the string. 

๐™€๐™ญ๐™–๐™ข๐™ฅ๐™ก๐™š : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ:


๐™ˆ๐™๐™‡๐™๐™„๐™‡๐™„๐™‰๐™€ ๐™Ž๐™๐™๐™„๐™‰๐™‚๐™Ž : 

                   You can assign a multiline string to a variable by using three quotes : 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


๐™Ž๐™๐™๐™„๐™‰๐™‚ ๐™๐™๐™‰๐˜พ๐™๐™„๐™Š๐™‰๐™Ž : 

✔ ๐™ž๐™ฃ๐™™๐™š๐™ญ() 

             index()  returns the position where it was found. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


 ๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐˜พ๐™ค๐™ช๐™ฃ๐™ฉ() 

              Count() returns the number of times  a specified value occurs in a string. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™›๐™ž๐™ฃ๐™™() 

          find() returns the position where it was found. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ž๐™จ๐™–๐™ก๐™ฃ๐™ช๐™ข() 

              isalnum() returns true if all characters in the string are alphanumeric. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ž๐™จ๐™–๐™ก๐™ฅ๐™๐™–() 

          isalpha() returns true if all characters in the string are alphabets. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ž๐™จ๐™™๐™š๐™˜๐™ž๐™ข๐™–๐™ก() 

                   isdecimal() returns true if all characters in the string are decimals. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ž๐™จ๐™™๐™ž๐™œ๐™ž๐™ฉ()

                 isdigit() returns true if all characters in the strings are digits. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ž๐™จ๐™ก๐™ค๐™ฌ๐™š๐™ง() 

              islower() returns true if all characters in the string are in lower case. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ž๐™จ๐™ช๐™ฅ๐™ฅ๐™š๐™ง() 

           isupper() returns true if all characters in the string is uppercase. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ž๐™จ๐™ฃ๐™ช๐™ข๐™š๐™ง๐™ž๐™˜() 

              isnumeric returns true if all characters in the string are numbers. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ž๐™จ๐™จ๐™ฅ๐™–๐™˜๐™š() 

                isspace() returns true if the string is whitespace. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :  


✔ ๐˜พ๐™–๐™ฅ๐™ž๐™ฉ๐™–๐™ก๐™ž๐™ฏ๐™š() 

                Capitalize() converts the first character to upper case. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™˜๐™–๐™จ๐™š๐™›๐™ค๐™ก๐™™()

                casefold() converts string into lower case.

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™˜๐™š๐™ฃ๐™ฉ๐™š๐™ง() 

                   center() returns a centered string. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 

 


✔ ๐™ง๐™š๐™ฅ๐™ก๐™–๐™˜๐™š() 

                    replace()  specified element in the string is replaced with new element. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™จ๐™ฉ๐™–๐™ง๐™ฉ๐™จ๐™ฌ๐™ž๐™ฉ๐™()

                 startswith() returns true if the string starts with the specified value. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™š๐™ฃ๐™™๐™จ๐™ฌ๐™ž๐™ฉ๐™() 

                   endswith() returns true if the string ends with specified value. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


๐™Ž๐™ค๐™ข๐™š ๐™ค๐™› ๐™ฉ๐™๐™š ๐™—๐™ช๐™ž๐™ก๐™ฉ-๐™ž๐™ฃ ๐™›๐™ช๐™ฃ๐™˜๐™ฉ๐™ž๐™ค๐™ฃ๐™จ :

✔ ๐™ง๐™ค๐™ช๐™ฃ๐™™() 

              round() returns a floating point number which is a rounded form of the specified number. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ : 

round(number,digits)

Here, 'digits' represents upto how many digits the number should be rounded. 

Eg : if digit=3,the number is rounded up to 3 decimal values. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ค๐™ง๐™™() 

            ord() returns the decimal value of the given character as per the ascii table. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ : 

ord(character)

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :



๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ค๐™˜๐™ฉ() 

            oct() converts an integer into an octal string. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ : 

oct(int) 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ข๐™–๐™ญ() 

            max() returns the items  highest value among the string alphabetically or if the given input is integer it returns the highest number. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ : 

max('n1','n2',......,'nn')

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™ข๐™ž๐™ฃ() 

           min() returns the items with lowest values among the string alphabetically or returns lowest number among integer. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

min('n1','n2',....,'nn')

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™‹๐™ค๐™ฌ() 

             pow() returns the value of 'x' to the power of 'y'.(x^y)

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

pow(x,y,z)

Here,the third parameter 'z' represent modulus which is optional. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :

 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


✔ ๐™–๐™จ๐™˜๐™ž๐™ž() 

              ascii() returns readable version of any objects such as strings, tuples, lists, etc..

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

ascii(objects)

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 


✔ ๐™—๐™ž๐™ฃ() 

             bin() returns the binary value of a number. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

bin(n)

Here, 'n' represents an integer. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ : 


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


✔ ๐™–๐™—๐™จ() 

             abs() returns the absolute  value of the specified number. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

abs(n)

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


✔ ๐™–๐™ฃ๐™ฎ() 

            any() returns true if any of the items is true otherwise it returns false. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

any(items)

Here, items represents 0,1 true and false given inside a  list, tuples, etc.. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


✔ ๐™–๐™ก๐™ก()

            all() returns true if all the items in a list are true otherwise it returns false. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

all(items)

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


✔ ๐™—๐™ค๐™ค๐™ก() 

            bool() returns the boolean value of  0 and 1.

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

bool(objects)

Here, 'objects' represents 0,1,strings,tuples,whitespaces etc...

It will return false for '0' and'whitespaces' otherwise true. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 



✔ ๐™˜๐™๐™ง() 

            chr() returns the character of the specified number as per the ascii value. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

chr(number)

It's just opposite to ord() function. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


✔ ๐™จ๐™ช๐™ข() 

                sum() returns the addition of all items. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ : 

sum(items,start)

Here, start is optional. 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


✔ ๐™˜๐™š๐™ž๐™ก() 

            ceil() returns a ceiling value of x.ie.. the largest integer not greater than x. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

import math

math. ceil(x) 

 ๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ :


✔ ๐™›๐™ก๐™ค๐™ค๐™ง() 

              floor() returns the floor of x. ie..the smallest integer not lesser than x. 

๐™Ž๐™ฎ๐™ฃ๐™ฉ๐™–๐™ญ :

import math

math. floor (x) 

๐™€๐™“๐˜ผ๐™ˆ๐™‹๐™‡๐™€ :


๐™Š๐™ช๐™ฉ๐™ฅ๐™ช๐™ฉ : 










             





            




       



          

             

             










Comments