๐พ๐๐๐๐๐๐ ๐๐ ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐
๐๐๐๐๐๐๐
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
Post a Comment