*.lower()
-lowercase all
*.upper()
-uppercase all
*{:.2f}
- format specifier in fstring than has accuracy of 2 decimal points
*.format()
-to format strings
"".join(list)
- prints a list as a string. list elements must be a string. so if not convert each to string first using str(i) for i in list
for eg
you can concatenate lists using +
operator .
empty_string = ""
empty_dict = {}
empty_set = set()
empty_tuple = ()
*if:
....
elif:
.....
else:
.....
*print(" ")
-print single line to display
*print(''' ...... ''')
-multiline print to display
*input("display statement")
- get input
*int()
-typecast int
*float()
-typecast float
*str()
-typecast str
*len()
- returns the size of a list
*.extend("data")
- adds the elements mentioned to the end of the list
*append()
-appends or attaches at the end of the list
$-$-$-import random
-$-$-$
random.randint(int a, int b)
-produces random number between a and b provided a < b
random.random(0.000,0.9999)
- for float random numbers . you mulitply by the range i.e for 1-5 float number randomvariable*5
random.choice(list)
- will pick a random element from the list
random.sample(list, number of elements in new list)
-creates a new list and with shuffled elements
random.shuffle(list)
-shuffles the list in place i.e. original list is overwritten by new list