Important Built-in functions in Python
Just iterating what we already know, Functions are nothing but a reusable piece of code which often takes some value, processes it and returns the result. The best thing about a function is that you can directly call the function anywhere in the code. Following are some of the important built-in functions which are mostly used in our projects. We are not giving an extensive and boring list of all the functions present in this Universe, the below list is hand-picked 😛
1. Typecasting – You can change the data type of a variable by typecasting it
x = Falsez = int(x)
2. Round() – Round function is used to round off any decimal number
round(2.54,1)2.5
3.Sorted(list, reverse = TRUE) – IT will sort the list in descending order
4.list_name.index(“element”) – It will get you the index of the specific element
5. list_name.append(“‘Saurav”) – It will append the element at the very end of the list.
6. list_name.upper() will change every element in the upper case
7. x.count(“data”) – This will count the number of occurrences of the word “data” in x
8. x.reverse() will reverse the order of the list x
9. max() and min() functions – Gets you maximum and minimum value from the list
10. len() – Returns the length of an object
11. abs() – Returns absolute value of a number
12. print() – Prints anything 😛
Above are all the built-in functions which we generally use. If you want the complete list, then go here. I just gave them a backlink 😛