

{"id":6772,"date":"2018-01-30T09:41:25","date_gmt":"2018-01-30T04:11:25","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=6772"},"modified":"2026-04-28T11:09:24","modified_gmt":"2026-04-28T05:39:24","slug":"python-built-in-functions","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/","title":{"rendered":"Python Built-In Functions with Syntax and Examples"},"content":{"rendered":"<p>We have talked about Functions in Python. In that tutorial of Python Functions, we discussed user-defined functions in Python. But that isn\u2019t all, a list of Python built-in functions that we can toy around with.<\/p>\n<p>In this tutorial on Built-in functions in Python, we will see each of those; we have 67 of those in Python 3.6 with their Python Syntax and examples.<\/p>\n<p>So, let&#8217;s start Python Built-In Functions.<\/p>\n<h3>What are Python Built-In Functions?<\/h3>\n<p>Python ships with many ready-made helpers called built-in functions. You do not import them; they sit in memory the moment the interpreter starts. Names like len, sum, and print pop up in almost every script because they solve everyday chores quickly.<\/p>\n<p>When you learn what each built-in function does, your code becomes shorter and more expressive. A one-line sum(numbers) tells more than a loop that adds by hand. Mastering this toolbox is the first step toward writing Pythonic programs that rank high in clarity and performance.<\/p>\n<h4>1. abs() in python<\/h4>\n<p>The abs() in python is one of the most popular Python built-in functions, which returns the absolute value of a number.<\/p>\n<p>A negative value\u2019s absolute is that value is positive.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; abs(-7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">7<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; abs(7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">7<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; abs(0)<\/pre>\n<h4>2. all() in python<\/h4>\n<p>The all() function in Python takes a container as an argument. This built-in function returns True if all values in a Python iterable have a Boolean value of True.<\/p>\n<p>An empty value has a Boolean value of False.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; all({'*','',''})<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">False<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; all([' ',' ',' '])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">True<\/div>\n<h4>3. any() in python<\/h4>\n<p>Like all(), it takes one argument and returns True if, even one value in the iterable has a Boolean value of True.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; any((1,0,0))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">True<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; any((0,0,0))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">False<\/div>\n<h4>4.\u00a0 ascii() in python<\/h4>\n<p>Python built-in functions must return a printable representation of a Python object (like a string or a Python list).<\/p>\n<p>Let\u2019s take a Romanian character.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; ascii('\u0219')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&#8220;&#8216;\\\\u0219&#8242;&#8221;<\/div>\n<p>Since this was a non-ASCII character in Python, the interpreter added a backslash (\\) and escaped it using another backslash.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; ascii('u\u0219or')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&#8220;&#8216;u\\\\u0219or'&#8221;<\/div>\n<p>Let\u2019s apply it to a list.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; ascii(['s','\u0219'])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&#8220;[&#8216;s&#8217;, &#8216;\\\\u0219&#8217;]&#8221;<\/div>\n<h4>5. bin() in python<\/h4>\n<p>The bin() function in Python converts an integer to a binary string. We have seen this and other functions in our article on Python Numbers.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; bin(7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&#8216;0b111&#8217;<\/div>\n<p>We can\u2019t apply it on floats, though.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; bin(7.0)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#20&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>bin(7.0)<\/p>\n<p>TypeError: &#8216;float&#8217; object cannot be interpreted as an integer<\/p>\n<\/div>\n<h4>6. bool() in python<\/h4>\n<p>The bool() function in Python converts a value to a Boolean.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; bool(0.5)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">True<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; bool('')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">False<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; bool(True)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<h4>7. bytearray() in python<\/h4>\n<p>The bytearray() function returns a Python array of a given byte size.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; a=bytearray(4)\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>bytearray(b&#8217;\\x00\\x00\\x00\\x00&#8242;)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a.append(1)\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>bytearray(b&#8217;\\x00\\x00\\x00\\x00\\x01&#8242;)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a[0]=1\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>bytearray(b&#8217;\\x01\\x00\\x00\\x00\\x01&#8242;)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a[0]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>1<\/p>\n<\/div>\n<p>Let\u2019s do this on a list.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; bytearray([1,2,3,4])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>bytearray(b&#8217;\\x01\\x02\\x03\\x04&#8242;)<\/p>\n<\/div>\n<h4>8. bytes() in Python<\/h4>\n<p>The bytes() function in Python returns an immutable bytes object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; bytes(5)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>b&#8217;\\x00\\x00\\x00\\x00\\x00&#8242;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; bytes([1,2,3,4,5])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>b&#8217;\\x01\\x02\\x03\\x04\\x05&#8242;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; bytes('hello','utf-8')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>b&#8217;hello&#8217;Here, utf-8 is the encoding.<\/p>\n<\/div>\n<p>Both bytes() and bytearray() deal with raw data, but bytearray() is mutable, while bytes() is immutable.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; a=bytes([1,2,3,4,5])\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>b&#8217;\\x01\\x02\\x03\\x04\\x05&#8242;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a[4]=<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>3Traceback (most recent call last):<\/p>\n<p>File &#8220;&lt;pyshell#46&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>a[4]=3<\/p>\n<p>TypeError: &#8216;bytes&#8217; object does not support item assignment<\/p>\n<\/div>\n<p>Let\u2019s try this on bytearray().<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; a=bytearray([1,2,3,4,5])\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>bytearray(b&#8217;\\x01\\x02\\x03\\x04\\x05&#8242;)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a[4]=3\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>bytearray(b&#8217;\\x01\\x02\\x03\\x04\\x03&#8242;)<\/p>\n<\/div>\n<h4>9. callable() in Python<\/h4>\n<p>The callable() function in Python tells us if an object can be called.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; callable([1,2,3])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>False<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; callable(callable)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; callable(False)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>False<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; callable(list)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<p>A function is callable; a list is not. Even the callable() Python built-in function is callable.<\/p>\n<h4>10. chr() in Python<\/h4>\n<p>chr() Built-in function returns the character in Python for an ASCII value.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; chr(65)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;A&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; chr(97)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;a&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; chr(9)\r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;\\t&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; chr(48)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;0&#8217;<\/p>\n<\/div>\n<h4>11. classmethod() in Python<\/h4>\n<p>The classmethod() function in Python returns a class method for a given method.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class fruit:\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 def sayhi(self):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(\"Hi, I'm a fruit\")\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n&gt;&gt;&gt; fruit.sayhi=classmethod(fruit.sayhi)\r\n&gt;&gt;&gt; fruit.sayhi()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Hi, I&#8217;m a fruit<\/p>\n<\/div>\n<p>When we pass the method sayhi() as an argument to classmethod(), it converts it into a Python class method that belongs to the class.<\/p>\n<p>Then, we call it like we would call any static method in Python without an object.<\/p>\n<h4>12. compile() in Python<\/h4>\n<p>The compile() function in Python returns a Python code object. We use Python in built function to convert a string code into object code.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; exec(compile('a=5\\nb=7\\nprint(a+b)','','exec'))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">12<\/div>\n<p>Here, \u2018exec\u2019 is the mode. The parameter before that is the filename for the file form which the code is read.<\/p>\n<p>Finally, we execute it using exec().<\/p>\n<h4>13. complex() in Python<\/h4>\n<p>The complex() function in Python creates a complex number. We have seen this in our article on Python Numbers.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; complex(3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(3+0j)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; complex(3.5)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(3.5+0j)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; complex(3+5j)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(3+5j)<\/p>\n<\/div>\n<h4>14. delattr() in Python<\/h4>\n<p>The delattr() function in Python takes two arguments- a class, and an attribute in it. It deletes the attribute.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class fruit:\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 size=7\u00a0\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n&gt;&gt;&gt; orange=fruit()\r\n&gt;&gt;&gt; orange.size<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>7<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; delattr(fruit,'size')\r\n&gt;&gt;&gt; orange.size<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#95&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>orange.size<\/p>\n<p>AttributeError: &#8216;fruit&#8217; object has no attribute &#8216;size&#8217;<\/p>\n<\/div>\n<h4>15. dict() in Python<\/h4>\n<p>The dict() function in Python, as we have seen it, creates a Python dictionary.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; dict()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>{}<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; dict([(1,2),(3,4)])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>{1: 2, 3: 4}<\/p>\n<\/div>\n<p>This was about dict() Python built-in function<\/p>\n<h4>16. dir() in Python<\/h4>\n<p>The dir() function in Python returns an object\u2019s attributes.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class fruit:\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 size=7\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 shape='round'\r\n&gt;&gt;&gt; orange=fruit()\r\n&gt;&gt;&gt; dir(orange)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;__class__&#8217;, &#8216;__delattr__&#8217;, &#8216;__dict__&#8217;, &#8216;__dir__&#8217;, &#8216;__doc__&#8217;, &#8216;__eq__&#8217;, &#8216;__format__&#8217;, &#8216;__ge__&#8217;, &#8216;__getattribute__&#8217;, &#8216;__gt__&#8217;, &#8216;__hash__&#8217;, &#8216;__init__&#8217;, &#8216;__init_subclass__&#8217;, &#8216;__le__&#8217;, &#8216;__lt__&#8217;, &#8216;__module__&#8217;, &#8216;__ne__&#8217;, &#8216;__new__&#8217;, &#8216;__reduce__&#8217;, &#8216;__reduce_ex__&#8217;, &#8216;__repr__&#8217;, &#8216;__setattr__&#8217;, &#8216;__sizeof__&#8217;, &#8216;__str__&#8217;, &#8216;__subclasshook__&#8217;, &#8216;__weakref__&#8217;, &#8216;shape&#8217;, &#8216;size&#8217;]<\/div>\n<h4>17. divmod() in Python<\/h4>\n<p>divmod() is a built-in function, takes two parameters, and returns a tuple of their quotient and remainder.<\/p>\n<p>In other words, it returns the floor division and the modulus of the two numbers.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; divmod(3,7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(0, 3)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; divmod(7,3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">(2, 1)<\/div>\n<p>If you encounter any doubt in Python Built-in Function, Please Comment.<\/p>\n<h4>18. enumerate() in Python<\/h4>\n<p>This Python built-in function returns an enumerate object. In other words, it adds a counter to the iterable.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; for i in enumerate(['a','b','c']):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(i)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">(0, &#8216;a&#8217;)<br \/>\n(1, &#8216;b&#8217;)<br \/>\n(2, &#8216;c&#8217;)<\/div>\n<h4>19. eval() in Python<\/h4>\n<p>The eval() Function in Python takes a string as an argument, which is parsed as an expression.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; x=7\r\n&gt;&gt;&gt; eval('x+7')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>14<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; eval('x+(x%2)')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>8<\/p>\n<\/div>\n<h4>20. exec() in Python<\/h4>\n<p>The exec() function runs Python code dynamically.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; exec('a=2;b=3;print(a+b)')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>5<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; exec(input(\"Enter your program\"))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Enter your programprint(2+3)5<\/p>\n<\/div>\n<h4>21. filter() in Python<\/h4>\n<p>Like we\u2019ve seen in python Lambda Expressios, filter() filters out the items for which the condition is True.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; list(filter(lambda x:x%2==0,[1,2,0,False]))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>[2, 0, False]<\/p>\n<\/div>\n<h4>22. float() in Python<\/h4>\n<p>This Python built-in function converts an int or a compatible value into a float.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; float(2)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>2.0<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; float('3')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>3.0<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; float('3s')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#136&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>float(&#8216;3s&#8217;)<\/p>\n<p>ValueError: could not convert string to float: &#8216;3s&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; float(False)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>0.0<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; float(4.7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>4.7<\/p>\n<\/div>\n<h4>23. format() in Python<\/h4>\n<p>We have seen this Python built-in function,<strong>\u00a0<\/strong>one in our lesson on Python Strings.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; a,b=2,3\r\n&gt;&gt;&gt; print(\"a={0} and b={1}\".format(a,b))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>a=2 and b=3<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; print(\"a={a} and b={b}\".format(a=3,b=4))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>a=3 and b=4<\/p>\n<\/div>\n<h4>24. frozenset() in Python<\/h4>\n<p>frozenset() returns an immutable frozenset object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; frozenset((3,2,4))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>frozenset({2, 3, 4})<\/p>\n<\/div>\n<h4>25. getattr() in Python<\/h4>\n<p>getattr() returns the value of an object\u2019s attribute.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; getattr(orange,'size')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>7<\/p>\n<\/div>\n<h4>26. globals() in Python<\/h4>\n<p>This Python built-in functions, returns a dictionary of the current global symbol table.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; globals()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>{&#8216;__name__&#8217;: &#8216;__main__&#8217;, &#8216;__doc__&#8217;: None, &#8216;__package__&#8217;: None, &#8216;__loader__&#8217;: &lt;class &#8216;_frozen_importlib.BuiltinImporter&#8217;&gt;, &#8216;__spec__&#8217;: None, &#8216;__annotations__&#8217;: {}, &#8216;__builtins__&#8217;: &lt;module &#8216;builtins&#8217; (built-in)&gt;, &#8216;fruit&#8217;: &lt;class &#8216;__main__.fruit&#8217;&gt;, &#8216;orange&#8217;: &lt;__main__.fruit object at 0x05F937D0&gt;, &#8216;a&#8217;: 2, &#8216;numbers&#8217;: [1, 2, 3], &#8216;i&#8217;: (2, 3), &#8216;x&#8217;: 7, &#8216;b&#8217;: 3}<\/p>\n<\/div>\n<h4>27. hasattr() in Python<\/h4>\n<p>Like delattr() and getattr(), hasattr() Python built-in functions, returns True if the object has that attribute.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hasattr(orange,'size')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hasattr(orange,'shape')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hasattr(orange,'color')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>False<\/p>\n<\/div>\n<h4>28. hash() in Python<\/h4>\n<p>hash() function returns the hash value of an object. And in Python, everything is an object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hash(orange)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>6263677<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hash(orange)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>6263677<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hash(True)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>1<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hash(0)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>0<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hash(3.7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>644245917<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hash(hash)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>25553952<\/p>\n<\/div>\n<p>This was all about hash() Python built-in function<\/p>\n<h4>29. help() in Python<\/h4>\n<p>To get details about any module, keyword, symbol, or topic, we use the help() function.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; help()\r\n\r\nWelcome\u00a0to\u00a0Python\u00a03.6's\u00a0help\u00a0utility!\r\n\r\nIf\u00a0this\u00a0is\u00a0your\u00a0first\u00a0time\u00a0using\u00a0Python,\u00a0you\u00a0should\u00a0definitely\u00a0check\u00a0out the\u00a0tutorial\u00a0on\u00a0the\u00a0Internet\u00a0at\u00a0http:\/\/docs.python.org\/3.6\/tutorial\/.\r\n\r\nEnter\u00a0the\u00a0name\u00a0of\u00a0any\u00a0module,\u00a0keyword,\u00a0or\u00a0topic\u00a0to\u00a0get\u00a0help\u00a0on\u00a0writing Python\u00a0programs\u00a0and\u00a0using\u00a0Python\u00a0modules.\u00a0\u00a0To\u00a0quit\u00a0this\u00a0help\u00a0utility\u00a0and return\u00a0to\u00a0the\u00a0interpreter,\u00a0just\u00a0type\u00a0\"quit\".\r\n\r\nTo\u00a0get\u00a0a\u00a0list\u00a0of\u00a0available\u00a0modules,\u00a0keywords,\u00a0symbols,\u00a0or\u00a0topics,\u00a0type \"modules\", \"keywords\", \"symbols\", or \"topics\". \u00a0Each module\u00a0also\u00a0comes with\u00a0a\u00a0one-line\u00a0summary\u00a0of\u00a0what\u00a0it\u00a0does;\u00a0to\u00a0list\u00a0the\u00a0modules\u00a0whose\u00a0name or\u00a0summary\u00a0contain\u00a0a\u00a0given\u00a0string\u00a0such\u00a0as\u00a0\"spam\",\u00a0type\u00a0\"modules\u00a0spam\".\r\n\r\nhelp&gt;\u00a0map\r\nHelp\u00a0on\u00a0class\u00a0map\u00a0in\u00a0module\u00a0builtins:\r\nclass\u00a0map(object)\r\n|\u00a0\u00a0map(func,\u00a0*iterables)\u00a0--&gt; map\u00a0object \r\n|\u00a0\r\n|\u00a0\u00a0Make\u00a0an\u00a0iterator\u00a0that\u00a0computes\u00a0the\u00a0function\u00a0using\u00a0arguments\u00a0from\r\n|\u00a0\u00a0each\u00a0of\u00a0the\u00a0iterables.\u00a0\u00a0Stops\u00a0when\u00a0the\u00a0shortest\u00a0iterable\u00a0is\u00a0exhausted.\r\n|\r\n|\u00a0\u00a0Methods\u00a0defined\u00a0here:\r\n|\r\n|\u00a0\u00a0__getattribute__(self,\u00a0name,\u00a0\/)\r\n|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Return\u00a0getattr(self,\u00a0name).\r\n|\r\n|\u00a0\u00a0__iter__(self,\u00a0\/)\r\n|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Implement\u00a0iter(self).\r\n|\r\n|\u00a0\u00a0__new__(*args,\u00a0**kwargs)\u00a0from\u00a0builtins.type\r\n|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Create\u00a0and\u00a0return\u00a0a\u00a0new\u00a0object.\u00a0\u00a0See\u00a0help(type)\u00a0for\u00a0accurate\u00a0signature.\r\n|\r\n|\u00a0\u00a0__next__(self,\u00a0\/)\r\n|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Implement\u00a0next(self).\r\n|\r\n|\u00a0\u00a0__reduce__(...)\r\n|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Return\u00a0state\u00a0information\u00a0for\u00a0pickling.\r\nhelp&gt; You are now leaving help and returning to the Python interpreter.\r\nIf you want to ask for help on a particular object directly from the\r\ninterpreter, you can type \"help(object)\".\u00a0 Executing \"help('string')\"\r\nhas the same effect as typing a particular string at the help&gt; prompt.\r\n&gt;&gt;&gt;<\/pre>\n<h4>30. hex() in Python<\/h4>\n<p>Hex()\u00a0Python built-in functions, converts an integer to hexadecimal.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hex(16)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;0x10&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; hex(False)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&#8216;0x0&#8217;<\/div>\n<h4>31. id() Function in Python<\/h4>\n<p>id() returns an object\u2019s identity.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; id(orange)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>100218832<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; id({1,2,3})==id({1,3,2})<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<h4>32.\u00a0 input() in Python<\/h4>\n<p>Input() Python built-in functions, reads and returns a line of string.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; input(\"Enter a number\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Enter a number7<br \/>\n&#8216;7&#8217;<\/div>\n<p>Note that this returns the input as a string. If we want to take 7 as an integer, we need to apply the int() function to it.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; int(input(\"Enter a number\"))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Enter a number77<\/p>\n<\/div>\n<h4>33. int() in Python<\/h4>\n<p>int() converts a value to an integer.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; int('7')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>7<\/p>\n<\/div>\n<h4>34. isinstance() V<\/h4>\n<p>We have seen this one in previous lessons. isinstance() takes a variable and a class as arguments.<\/p>\n<p>Then, it returns True if the variable belongs to the class. Otherwise, it returns False.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; isinstance(0,str)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>False<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; isinstance(orange,fruit)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<h4>35. issubclass() in Python<\/h4>\n<p>This Python built-in function takes two arguments- two Python classes. If the first class is a subclass of the second, it returns True.<\/p>\n<p>Otherwise, it returns False.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; issubclass(fruit,fruit)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class fruit:\r\n           pass\r\n&gt;&gt;&gt; class citrus(fruit):\r\n           pass<\/pre>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; issubclass(fruit,citrus)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>False<\/p>\n<\/div>\n<h4>36. iter() in Python<\/h4>\n<p>Iter() is built-in functions returns a Python iterator for an object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; for i in iter([1,2,3]):\r\n            print(i)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n2<br \/>\n3<\/div>\n<h4>37. len() in Python<\/h4>\n<p>We\u2019ve seen len() so many times by now. It returns the length of an object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; len({1,2,2,3})<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>3<\/p>\n<\/div>\n<p>Here, we get 3 instead of 4, because the set takes the value \u20182\u2019 only once.<\/p>\n<h4>38. list() in Python<\/h4>\n<p>list() creates a list from a sequence of values.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; list({1,3,2,2})<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>[1, 2, 3]<\/p>\n<\/div>\n<h4>39. locals() in Python<\/h4>\n<p>This function returns a dictionary of the current local symbol table.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; locals()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>{&#8216;__name__&#8217;: &#8216;__main__&#8217;, &#8216;__doc__&#8217;: None, &#8216;__package__&#8217;: None, &#8216;__loader__&#8217;: &lt;class &#8216;_frozen_importlib.BuiltinImporter&#8217;&gt;, &#8216;__spec__&#8217;: None, &#8216;__annotations__&#8217;: {}, &#8216;__builtins__&#8217;: &lt;module &#8216;builtins&#8217; (built-in)&gt;, &#8216;fruit&#8217;: &lt;class &#8216;__main__.fruit&#8217;&gt;, &#8216;orange&#8217;: &lt;__main__.fruit object at 0x05F937D0&gt;, &#8216;a&#8217;: 2, &#8216;numbers&#8217;: [1, 2, 3], &#8216;i&#8217;: 3, &#8216;x&#8217;: 7, &#8216;b&#8217;: 3, &#8216;citrus&#8217;: &lt;class &#8216;__main__.citrus&#8217;&gt;}<\/p>\n<\/div>\n<h4>40. map() in Python<\/h4>\n<p>Like filter(), map(), Python built-in functions, take a function and apply it to an iterable. It maps True or False values on each item in the iterable.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; list(map(lambda x:x%2==0,[1,2,3,4,5]))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>[False, True, False, True, False]<\/p>\n<\/div>\n<h4>41. max() in Python<\/h4>\n<p>A no-brainer, max() returns the item, in a sequence, with the highest value of all.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; max(2,3,4)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>4<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; max([3,5,4])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>5<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; max('hello','Hello')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;hello&#8217;<\/p>\n<\/div>\n<h4>42. memoryview() in Python<\/h4>\n<p>memoryview() shows us the memory view of an argument.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; a=bytes(4)\r\n&gt;&gt;&gt; memoryview(a)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;memory at 0x05F9A988&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; for i in memoryview(a): \r\n         print(i)<\/pre>\n<h4>43. min() in Python<\/h4>\n<p>min() returns the lowest value in a sequence.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; min(3,5,1)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>1<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; min(True,False)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>False<\/p>\n<\/div>\n<h4>44. next() in Python<\/h4>\n<p>This Python Built In function returns the next element from the iterator.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; myIterator=iter([1,2,3,4,5])\r\n&gt;&gt;&gt; next(myIterator)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>1<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; next(myIterator)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>2<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; next(myIterator)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>3<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; next(myIterator)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>4<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; next(myIterator)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>5<\/p>\n<\/div>\n<p>Now that we\u2019ve traversed all items, when we call next(), it raises StopIteration.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; next(myIterator)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#392&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>next(myIterator)<\/p>\n<p>StopIteration<\/p>\n<\/div>\n<h4>45. object() in Python<\/h4>\n<p>Object()\u00a0Python built-in functions, creates a featureless object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; o=object()\r\n&gt;&gt;&gt; type(o)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;class &#8216;object&#8217;&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; dir(o)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;__class__&#8217;, &#8216;__delattr__&#8217;, &#8216;__dir__&#8217;, &#8216;__doc__&#8217;, &#8216;__eq__&#8217;, &#8216;__format__&#8217;, &#8216;__ge__&#8217;, &#8216;__getattribute__&#8217;, &#8216;__gt__&#8217;, &#8216;__hash__&#8217;, &#8216;__init__&#8217;, &#8216;__init_subclass__&#8217;, &#8216;__le__&#8217;, &#8216;__lt__&#8217;, &#8216;__ne__&#8217;, &#8216;__new__&#8217;, &#8216;__reduce__&#8217;, &#8216;__reduce_ex__&#8217;, &#8216;__repr__&#8217;, &#8216;__setattr__&#8217;, &#8216;__sizeof__&#8217;, &#8216;__str__&#8217;, &#8216;__subclasshook__&#8217;]<\/div>\n<p>Here, the function type() tells us that it\u2019s an object. dir() tells us the object\u2019s attributes. But since this does not have the __dict__ attribute, we can\u2019t assign to arbitrary attributes.<\/p>\n<h4>46. oct() in Python<\/h4>\n<p>oct() converts an integer to its octal representation.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; oct(7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;0o7&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; oct(8)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;0o10&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; oct(True)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;0o1&#8217;<\/p>\n<\/div>\n<h4>47. open() in Python<\/h4>\n<p>open() lets us open a file. Let\u2019s change the current working directory to Desktop.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import os\r\n&gt;&gt;&gt; os.chdir('C:\\\\Users\\\\lifei\\\\Desktop')<\/pre>\n<p>Now, we open the file \u2018topics.txt\u2019.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; f=open('topics.txt')\r\n&gt;&gt;&gt; f<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;_io.TextIOWrapper name=&#8217;topics.txt&#8217; mode=&#8217;r&#8217; encoding=&#8217;cp1252&#8242;&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; type(f)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;class &#8216;_io.TextIOWrapper&#8217;&gt;<\/p>\n<\/div>\n<p>To read from the file, we use the read() method.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; print(f.read())\r\nDBMS mappings\r\nprojection\r\nunion\r\nrdbms vs dbms\r\ndoget dopost\r\nhow to add maps\r\nOOT\r\nSQL queries\r\nJoin\r\nPattern programs<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Default constructor in inheritance<\/p>\n<\/div>\n<h4>48. ord() in Python<\/h4>\n<p>The function ord() returns an integer that represents the Unicode point for a given Unicode character.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; ord('A')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>65<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; ord('9')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">57<\/div>\n<p>This is complementary to chr().<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; chr(65)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;A&#8217;<\/p>\n<\/div>\n<h4>49. pow() in Python<\/h4>\n<p>pow() takes two arguments- say, x and y. It then returns the value of x to the power of y.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pow(3,4)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>81<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pow(7,0)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>1<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pow(7,-1)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>0.14285714285714285<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pow(7,-2)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>0.02040816326530612<\/p>\n<\/div>\n<h4>50. print() in Python<\/h4>\n<p>We don\u2019t think we need to explain this anymore. We\u2019ve been seeing this function since the beginning of this article.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; print(\"Okay, next function, please!\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Okay, next function, please!<\/p>\n<\/div>\n<h4>51. property() in Python<\/h4>\n<p>The function property() returns a property attribute. Alternatively, we can use the syntactic sugar @property.<\/p>\n<p>We will learn this in detail in our tutorial on Python Property.<\/p>\n<h4>52. range() in Python<\/h4>\n<p>We\u2019ve taken a whole tutorial on this. Read up range() in Python.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; for i in range(7,2,-2):\r\n         print(i)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">7<br \/>\n5<br \/>\n3<\/div>\n<h4>53. repr() in Python<\/h4>\n<p>repr() returns a representable string of an object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; repr(\"Hello\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8220;&#8216;Hello'&#8221;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; repr(7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;7&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; repr(False)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;False&#8217;<\/p>\n<\/div>\n<h4>54. reversed() in Python<\/h4>\n<p>This function reverses the contents of an iterable and returns an iterator object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; a=reversed([3,2,1])\r\n&gt;&gt;&gt; a\r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;list_reverseiterator object at 0x02E1A230&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; for i in a:\r\nprint(i)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n2<br \/>\n3<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; type(a)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;class &#8216;list_reverseiterator&#8217;&gt;<\/p>\n<\/div>\n<h4>55. round() in Python<\/h4>\n<p>round() rounds off a float to the given number of digits (given by the second argument).<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; round(3.777,2)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>3.78<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; round(3.7,3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>3.7<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; round(3.7,-1)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>0.0<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; round(377.77,-1)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>380.0<\/p>\n<\/div>\n<p>The rounding factor can be negative.<\/p>\n<h4>56. set() in Python<\/h4>\n<p>Of course, set() returns a set of the items passed to it.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; set([2,2,3,1])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">{1, 2, 3}<\/div>\n<p>Remember, a set cannot have duplicate values, and isn\u2019t indexed, but is ordered. Read on Sets and Booleans for the same.<\/p>\n<h4>57. setattr() in Python<\/h4>\n<p>Like getattr(), setattr() sets an attribute\u2019s value for an object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; orange.size<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>7<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; orange.size=8\r\n&gt;&gt;&gt; orange.size<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>8<\/p>\n<\/div>\n<h4>58. slice() in Python<\/h4>\n<p>slice() returns a slice object that represents the set of indices specified by range(start, stop, step).<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; slice(2,7,2)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>slice(2, 7, 2)<\/p>\n<\/div>\n<p>We can use this to iterate on an iterable like a string in python.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; 'Python'[slice(1,5,2)]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;yh&#8217;<\/p>\n<\/div>\n<h4>59.\u00a0 sorted() in Python<\/h4>\n<p>Like we\u2019ve seen before, sorted() prints out a sorted version of an iterable. It does not, however, alter the iterable.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; sorted('Python')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>[&#8216;P&#8217;, &#8216;h&#8217;, &#8216;n&#8217;, &#8216;o&#8217;, &#8216;t&#8217;, &#8216;y&#8217;]<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; sorted([1,3,2])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>[1, 2, 3]<\/p>\n<\/div>\n<h4>60. staticmethod() in Python<\/h4>\n<p>staticmethod() creates a static method from a function. A static method is bound to a class rather than to an object.<\/p>\n<p>But it can be called on the class or on an object.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class fruit:\r\n            def sayhi():\r\n                          print(\"Hi\")\r\n&gt;&gt;&gt; fruit.sayhi=staticmethod(fruit.sayhi)\r\n&gt;&gt;&gt; fruit.sayhi()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Hi<\/div>\n<p>You can also use the syntactic sugar @staticmethod for this.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class fruit:\r\n            @staticmethod\r\n             def sayhi():\r\n                     print(\"Hi\")\r\n&gt;&gt;&gt; fruit.sayhi()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Hi<\/p>\n<\/div>\n<h4>61. str() in Python<\/h4>\n<p>str() takes an argument and returns the string equivalent of it.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; str('Hello')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;Hello&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; str(7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;7&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; str(8.7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;8.7&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; str(False)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;False&#8217;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; str([1,2,3])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&#8216;[1, 2, 3]&#8217;<\/p>\n<\/div>\n<h4>62. sum() in Python<\/h4>\n<p>The function sum() takes an iterable as an argument, and returns the sum of all values.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; sum([3,4,5],3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>15<\/p>\n<\/div>\n<h4>63. super() in Python<\/h4>\n<p>super() returns a proxy object to let you refer to the parent class.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class person:\r\n           def __init__(self):\r\n               print(\"A person\")\r\n&gt;&gt;&gt; class student(person):\r\n            def __init__(self):\r\n                super().__init__()\r\n                print(\"A student\")\r\n&gt;&gt;&gt; Avery=student()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>A personA student<\/p>\n<\/div>\n<h4>64. tuple() in Python<\/h4>\n<p>As we\u2019ve seen in our tutorial on Python Tuples, the function tuple() lets us create a tuple.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; tuple([1,3,2])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(1, 3, 2)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; tuple({1:'a',2:'b'})<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(1, 2)<\/p>\n<\/div>\n<h4>65. type() in Python<\/h4>\n<p>We have been seeing the type() function to check the type of object we\u2019re dealing with.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; type({})<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;class &#8216;dict&#8217;&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; type(set())<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;class &#8216;set&#8217;&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; type(())<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;class &#8216;tuple&#8217;&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; type((1))\r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>&lt;class &#8216;int&#8217;&gt;<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; type((1,))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&lt;class &#8216;tuple&#8217;&gt;<\/div>\n<h4>66. vars() in Python<\/h4>\n<p>vars() function returns the __dict__ attribute of a class.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; vars(fruit)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>mappingproxy({&#8216;__module__&#8217;: &#8216;__main__&#8217;, &#8216;size&#8217;: 7, &#8216;shape&#8217;: &#8217;round&#8217;, &#8216;__dict__&#8217;: &lt;attribute &#8216;__dict__&#8217; of &#8216;fruit&#8217; objects&gt;, &#8216;__weakref__&#8217;: &lt;attribute &#8216;__weakref__&#8217; of &#8216;fruit&#8217; objects&gt;, &#8216;__doc__&#8217;: None})<\/p>\n<\/div>\n<h4>67. zip() in Python<\/h4>\n<p>zip() returns us an iterator of tuples.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; set(zip([1,2,3],['a','b','c']))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>{(1, &#8216;a&#8217;), (3, &#8216;c&#8217;), (2, &#8216;b&#8217;)}<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; set(zip([1,2],[3,4,5]))<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>{(1, 3), (2, 4)}<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; a=zip([1,2,3],['a','b','c'])<\/pre>\n<p>To unzip this, we write the following code.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; x,y,z=a\r\n&gt;&gt;&gt; x<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(1, &#8216;a&#8217;)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; y<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(2, &#8216;b&#8217;)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; z<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">(3, &#8216;c&#8217;)<\/div>\n<p>Isn\u2019t this just like tuple unpacking? So, this was all about Python Built-in Functions. Hope you like our explanation.<\/p>\n<h3>Python Interview Question on Built-in Functions<\/h3>\n<p>1. What are the built-in functions in Python?<\/p>\n<p>2. How many built-in functions does Python have?<\/p>\n<p>3. Give an example of a built-in function in the Python library.<\/p>\n<p>4. What are the built-in functions in Python?<\/p>\n<p>5. How do you find the built-in functions in Python?<\/p>\n<h3>Conclusion<\/h3>\n<p>Phew, was that too much for once? It may be overwhelming at once, but as you will get using these python Built-in functions, you will get used to them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have talked about Functions in Python. In that tutorial of Python Functions, we discussed user-defined functions in Python. But that isn\u2019t all, a list of Python built-in functions that we can toy around&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":42119,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[2223,36643,36642,4972,10397,16709],"class_list":["post-6772","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-built-in-functions-in-python","tag-explain-built-in-function-with-example","tag-explain-built-in-function-with-their-types","tag-functions-in-python","tag-python-built-in-functions","tag-types-of-built-in-functions-in-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Built-In Functions with Syntax and Examples - DataFlair<\/title>\n<meta name=\"description\" content=\"Python ships with many ready-made helpers called built-in functions. You do not import them; they sit in memory the moment the interpreter starts.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Built-In Functions with Syntax and Examples - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python ships with many ready-made helpers called built-in functions. You do not import them; they sit in memory the moment the interpreter starts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-30T04:11:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-28T05:39:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Built-in-functions-1024x536-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Built-In Functions with Syntax and Examples - DataFlair","description":"Python ships with many ready-made helpers called built-in functions. You do not import them; they sit in memory the moment the interpreter starts.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/","og_locale":"en_US","og_type":"article","og_title":"Python Built-In Functions with Syntax and Examples - DataFlair","og_description":"Python ships with many ready-made helpers called built-in functions. You do not import them; they sit in memory the moment the interpreter starts.","og_url":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-01-30T04:11:25+00:00","article_modified_time":"2026-04-28T05:39:24+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Built-in-functions-1024x536-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Built-In Functions with Syntax and Examples","datePublished":"2018-01-30T04:11:25+00:00","dateModified":"2026-04-28T05:39:24+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/"},"wordCount":2526,"commentCount":15,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Built-in-functions-1024x536-1.jpg","keywords":["Built-In functions in Python","explain built in function with example","explain built in function with their types","functions in python","Python Built-In functions","Types of Built-in functions in Python"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-built-in-functions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/","url":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/","name":"Python Built-In Functions with Syntax and Examples - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Built-in-functions-1024x536-1.jpg","datePublished":"2018-01-30T04:11:25+00:00","dateModified":"2026-04-28T05:39:24+00:00","description":"Python ships with many ready-made helpers called built-in functions. You do not import them; they sit in memory the moment the interpreter starts.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-built-in-functions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Built-in-functions-1024x536-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Built-in-functions-1024x536-1.jpg","width":1200,"height":628,"caption":"Python Built-In Functions with Syntax and Examples"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Built-In Functions with Syntax and Examples"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/6772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=6772"}],"version-history":[{"count":29,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/6772\/revisions"}],"predecessor-version":[{"id":147593,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/6772\/revisions\/147593"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/42119"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=6772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=6772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=6772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}