{"id":9691,"date":"2020-04-02T16:26:06","date_gmt":"2020-04-02T10:56:06","guid":{"rendered":"http:\/\/ivyproschool.com\/blog\/?p=9691"},"modified":"2021-06-11T11:40:04","modified_gmt":"2021-06-11T06:10:04","slug":"top-15-interesting-tricks-every-python-beginner-must-know","status":"publish","type":"post","link":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/","title":{"rendered":"Top 15 Interesting Tricks Every Python Beginner Must Know"},"content":{"rendered":"<p><a href=\"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9696 size-medium\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover-300x139.png\" alt=\"Top 15 tricks every python beginner must know\" width=\"300\" height=\"139\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover-300x139.png 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover-768x356.png 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover-1024x474.png 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover.png 1080w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We have covered <a href=\"https:\/\/ivyproschool.com\/blog\/2020\/03\/20\/top-5-python-data-types-that-you-should-know\/\">Python Data Types<\/a> and <a href=\"https:\/\/ivyproschool.com\/blog\/2020\/03\/26\/python-loop\/\">Loops in Python<\/a> earlier. I hope you find them useful. Moving ahead with our Python learning, in this article we are going to talk about the top 15 interesting tricks every Python beginner must know.<\/p>\n<p>First of all, let us understand about Functions and Methods.<\/p>\n<h3>Function &#8211;<\/h3>\n<p>A Function is an independent block of code that can be called by its name with or without any parameter. We can create a function that does or does not return any value as an output.<\/p>\n<h3>Method &#8211;<\/h3>\n<p>All methods are functions associated with an object of the class in which it is defined.<\/p>\n<p>Now we will explain various Functions and Methods related to Strings and Lists along with some examples.<\/p>\n<h2>Python in String related Functions &amp; Methods &#8211;<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9692 size-medium\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/String-300x139.png\" alt=\"String in python\" width=\"300\" height=\"139\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/String-300x139.png 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/String-768x356.png 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/String-1024x474.png 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/String.png 1080w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3>Title() &#8211;<\/h3>\n<p>This method can be used to convert the first letter of the words in a string to its upper case. We can get a look at the way we write the title of any article.<\/p>\n<div>\n<pre>a&nbsp;=&nbsp;\"corona&nbsp;virus&nbsp;spreads&nbsp;throughout&nbsp;the&nbsp;planet\"\r\na.title()<\/pre>\n<\/div>\n<h3>Swapcase() &#8211;<\/h3>\n<p>As the name suggests, this method is to convert the uppercase letter to lower case and vice versa.<\/p>\n<div>\n<pre>a&nbsp;=&nbsp;\"cORONA&nbsp;vIRUS&nbsp;sPREADS&nbsp;throughout&nbsp;the&nbsp;planet\"\r\na.swapcase()<\/pre>\n<\/div>\n<h3>Split() &#8211;<\/h3>\n<p>We can use the split method to split a string on a separator. An option to split the string as many times as we want is also available.<\/p>\n<div>\n<div>\n<pre>a = \"My Name Is Donald Trump\"\r\na.split()<\/pre>\n<\/div>\n<\/div>\n<pre>a = \"My-Name-Is-Donald-Trump\"\r\na.split(sep=\"-\")<\/pre>\n<pre>a = \"My-Name-Is-Donald-Trump\"\r\na.split(sep&nbsp;='-',maxsplit=3)<\/pre>\n<h3>Replace() &#8211;<\/h3>\n<p>If we want to replace a word with another, we can use the replace method on the String object.<\/p>\n<div>\n<pre>a = \"My Name Is Donald Trump. I like Mickey Donald and McDonald\"\r\na.replace('Donald', 'Obama')<\/pre>\n<\/div>\n<h3>Join() &#8211;<\/h3>\n<div>To join a string to another iterable string, we use the join method shown below.<\/div>\n<div>\n<div>\n<pre>a = \".\"\r\na.join(\"UNICEF\")<\/pre>\n<\/div>\n<\/div>\n<pre>a = \"Name \"\r\nb = \"Place\"a.join(b)<\/pre>\n<h3>Index()-<\/h3>\n<p>To find the index of the first match of any character in a string, we can use the index method on the String object. The 2 different commands shown below gives the same output that is the first instance of matching of character &#8220;C&#8221;.<\/p>\n<div>\n<pre>a = \"UNICEF\"\r\na.index(\"C\")<\/pre>\n<\/div>\n<pre>a = \"UNICEF UNICEF UNICEF\"a.index(\"C\")<\/pre>\n<div>At times when we want to match a word instead of a letter, the index of the first letter matched in a match situation is given as the output. When a match is not found, a ValueError is thrown.<\/div>\n<div>\n<div>\n<pre>a = \"UNICEF UNICEF UNICEF\"\r\na.index(\"CEF\")<\/pre>\n<\/div>\n<\/div>\n<h3>Capitalize() &#8211;<\/h3>\n<p>To convert the first letter in a string to an upper case, we can use this method.<\/p>\n<div>\n<pre>a&nbsp;=&nbsp;\"unicef&nbsp;unicef&nbsp;unicef\"\r\na.capitalize()<\/pre>\n<\/div>\n<h3>Reverse() &#8211;<\/h3>\n<p>A very interesting method provided in Python is to reverse iterable elements.<\/p>\n<div>\n<pre>a&nbsp;=&nbsp;[\"Name\",&nbsp;\"Surname\",&nbsp;\"Age\",&nbsp;\"City\"]\r\na.reverse()\r\nprint(a)<\/pre>\n<\/div>\n<h2>Python Lambda Function &#8211;<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9695 size-medium\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/lambda-300x139.png\" alt=\"lambda in python\" width=\"300\" height=\"139\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/lambda-300x139.png 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/lambda-768x356.png 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/lambda-1024x474.png 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/lambda.png 1080w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>lambda helps code simple anonymous functions. It is a single line function which can have any number of the argument. A Lambda function is restricted to contain only a single expression. These are used when you need a function for a short period. Let us look at some examples.<\/p>\n<pre>cube = lambda x : x*x*x\r\ncube(9)<\/pre>\n<p>The above code gives the cube of a number. We did not define a function explicitly which simplifies our task to a great extent.<\/p>\n<p>The below set of code allows us to join the two columns of our data Data Frame.<\/p>\n<pre>data&nbsp;=&nbsp;{'Name':[\"Donald\"&nbsp;,&nbsp;\"Barack\"&nbsp;,&nbsp;\"Sachin\",&nbsp;\"Mary\"],&nbsp;'Surname':[\"Trump\",\"Obama\",\"Tendulkar\",\"Kom\"]}&nbsp;\r\nimport&nbsp;pandas&nbsp;as&nbsp;pd\r\ndata&nbsp;=&nbsp;pd.DataFrame(data,&nbsp;index=None)\r\ndata['Full&nbsp;Name']&nbsp;=&nbsp;data[['Name',&nbsp;'Surname']].apply(lambda&nbsp;x:&nbsp;'&nbsp;'.join(x),&nbsp;axis&nbsp;=&nbsp;1)&nbsp;\r\nprint(data)<\/pre>\n<h3>Reversing a string &#8211;<\/h3>\n<div>\n<pre>reverse_string = lambda s: s[::-1]\r\nreverse_string('hello my name is Anthony Gonsalves')<\/pre>\n<\/div>\n<h2>Python in List related Functions &amp; Methods &#8211;<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9693 size-medium\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/List-300x139.png\" alt=\"List in python\" width=\"300\" height=\"139\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/List-300x139.png 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/List-768x356.png 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/List-1024x474.png 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/List.png 1080w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3>Counter &#8211;<\/h3>\n<p>It is a function we can apply on a list to count the number of occurrences of its elements. Counter makes our task of counting values very easy.<\/p>\n<div>\n<div>\n<div>\n<pre>from collections import Counter\r\nlist_of_digits = [1,2,3,4,5,5,2,2,2,3,4,5,3,2,1,3,4]\r\ncount&nbsp;=&nbsp;Counter(list_of_digits)<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<h3>Reduce &#8211;<\/h3>\n<p>If we want to apply a function on a sequence of an iterable list, reduce comes in handy used along with a lambda function. The reduce function works in a below-mentioned manner:<\/p>\n<ul>\n<li>The first two elements in the sequence are picked up and the called function is applied on those two to obtain a result<\/li>\n<li>The next step is to apply the same function to the result obtained above and the third element from the sequence and the result is saved.<\/li>\n<li>This process continues until the sequence of list exhausts.<\/li>\n<li>we can see the final result on the console.<\/li>\n<\/ul>\n<p>To find the maximum number in a list of numeric elements, we use the below provided reduce command.<\/p>\n<div>\n<div>\n<div>\n<pre>#Syntax : reduce(function, sequence)\r\nfrom functools import reduce\r\nlist2 = [3,4,5, 33, -33, 234, 1, 223]\r\nreduce(lambda&nbsp;x,y&nbsp;:x&nbsp;if&nbsp;x&gt;y&nbsp;else&nbsp;y&nbsp;,&nbsp;list2)<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<h3>Filter &#8211;<\/h3>\n<p>The filter function creates a new iterator from the existing iterable based on some filter condition wherever it gives true value.<\/p>\n<div>\n<pre>#Syntax: filter(function, sequence)\r\nlist1&nbsp;=&nbsp;[1,2,'a',4,5,'b',7,8,9]\r\nlist(filter(lambda&nbsp;x&nbsp;:&nbsp;type(x)==int&nbsp;,&nbsp;list1))<\/pre>\n<\/div>\n<h3>Range &#8211;<\/h3>\n<p>The range is a simple function that helps create a sequence of numbers. We can give three arguments that are start value, stop value, and step to generate the sequence.<\/p>\n<div>\n<div>\n<div>\n<pre>#Syntax: range(start, stop, step)\r\nfor&nbsp;item&nbsp;in&nbsp;range(1,10):\r\n&nbsp;&nbsp;&nbsp; print(item)<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<h3>Map &#8211;<\/h3>\n<p>The map function applies a function on each element of a sequence and returns a map iterable object containing the results.<\/p>\n<pre>#Syntax: map(function, iterable)\r\nFirst_List = [3,6,2,1,9]\r\nlist(map(lambda x : x*x, First_List ))<\/pre>\n<h3>Sort &#8211;<\/h3>\n<p>As the name suggests, we can apply this method to generate a sorted sequence of an iterable. The &#8216;reverse&#8217; argument is set to True or False to get a descending or an ascending sorted output.<\/p>\n<div>\n<pre>First_List&nbsp;=&nbsp;[3,6,2,1,9]\r\n(First_List.sort(reverse=True))\r\nprint(First_List)\r\n\r\nFirst_List = ['z','x','t','w']\r\n(First_List.sort(reverse=True))\r\nprint(First_List)<\/pre>\n<\/div>\n<h3>enumerate &#8211;<\/h3>\n<p>The enumerate built-in function is very useful when we want to loop over something and have a counter. We can also pass an optional argument &#8216;start&#8217; which helps us start the index of the counter from wherever we want. By default, the start parameter value is 0. The returned object is an enumerate object.<\/p>\n<pre>#Syntax : enumerate(iterable, start)\r\nNames = [\"Chris\",\"Kalam\",\"Sandeep\"]\r\nNames.sort()\r\nfor&nbsp;Roll_no,j&nbsp;in&nbsp;enumerate(Names&nbsp;,1):\r\n &nbsp;&nbsp; print('{}:{}'.format(Roll_no,j))\r\n\r\nThe code above takes a list of names, sorts it, and then uses an enumerate function to generate a counter named as roll_no in this case.<\/pre>\n<h2>Python Bonus Trick-<\/h2>\n<p>A very interesting short cut Python provides is for interchanging values of 2 variables. Usually, it requires another temporary variable to complete the swapping task. Python makes it very easy to swap values with the below set of commands in the image.<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9694 size-medium\" src=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Swap-300x139.png\" alt=\"swapping two numbers in python\" width=\"300\" height=\"139\" srcset=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Swap-300x139.png 300w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Swap-768x356.png 768w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Swap-1024x474.png 1024w, https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Swap.png 1080w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/div>\n<h2>Conclusion &#8211;<\/h2>\n<div>Being a Python beginner, it is not possible for a learner to know it all from the very start. Hence, we have explained the top 15 interesting tricks every Python beginner must know. We are coming up with more on Python for our learners. Stay tuned. Happy Learning!!!<\/div>\n","protected":false},"excerpt":{"rendered":"<p>We have covered Python Data Types and Loops in Python earlier. I hope you find them useful. Moving ahead with our Python learning, in this article we are going to talk about the top 15 interesting tricks every Python beginner must know. First of all, let us understand about Functions and Methods. Function &#8211; A Function is an independent block of code that can be called by its name with or without any parameter. We can create a function that does or does not return any value as an output. Method &#8211; All methods are functions associated with an object of the class in which it is defined. Now we will explain various Functions and Methods related to Strings and Lists along with some examples. Python in String related Functions &amp; Methods &#8211; Title() &#8211; This method can be used to convert the first letter of the words in a string to its upper case. We can get a look at the way we write the title of any article. a&nbsp;=&nbsp;&#8220;corona&nbsp;virus&nbsp;spreads&nbsp;throughout&nbsp;the&nbsp;planet&#8221; a.title() Swapcase() &#8211; As the name suggests, this method is to convert the uppercase letter to lower case and vice versa. a&nbsp;=&nbsp;&#8220;cORONA&nbsp;vIRUS&nbsp;sPREADS&nbsp;throughout&nbsp;the&nbsp;planet&#8221; a.swapcase() Split() &#8211; We can use the [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":9696,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[851,5,881,715,552,551],"tags":[714,43,467,816,819,817,140,716,818,814,815,820],"class_list":["post-9691","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business-analytics","category-data-analytics","category-data-science","category-machine-learning-ai","category-technology","category-tools-softwares","tag-artificial-intelligence","tag-big-data","tag-data-science","tag-filter","tag-join","tag-map","tag-predictive-analytics","tag-python","tag-reduce","tag-reverse","tag-split","tag-swap"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Top 15 Interesting Tricks a Python Beginner Must Know | Ivy Pro School<\/title>\n<meta name=\"description\" content=\"Top 15 Tricks that every Python beginner must know. Read the article to know what those tricks are. Get Started on Python with Ivy Pro School.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Top 15 Interesting Tricks a Python Beginner Must Know | Ivy Pro School\" \/>\n<meta property=\"og:description\" content=\"Top 15 Tricks that every Python beginner must know. Read the article to know what those tricks are. Get Started on Python with Ivy Pro School.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/\" \/>\n<meta property=\"og:site_name\" content=\"R vs Python: Which Analytics Tool Should You Choose for Data Science?\" \/>\n<meta property=\"article:author\" content=\"https:\/\/facebook.com\/ivyproschool\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-02T10:56:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-11T06:10:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ivy Professional School\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ivyproschool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ivy Professional School\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/\"},\"author\":{\"name\":\"Ivy Professional School\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#\\\/schema\\\/person\\\/31fdab8559dd3db99173764bfb60215d\"},\"headline\":\"Top 15 Interesting Tricks Every Python Beginner Must Know\",\"datePublished\":\"2020-04-02T10:56:06+00:00\",\"dateModified\":\"2021-06-11T06:10:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/\"},\"wordCount\":900,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/Cover.png\",\"keywords\":[\"Artificial Intelligence\",\"Big Data\",\"data science\",\"Filter\",\"Join\",\"Map\",\"predictive analytics\",\"python\",\"Reduce\",\"Reverse\",\"Split\",\"Swap\"],\"articleSection\":[\"Business Analytics\",\"Data Analytics\",\"Data Science\",\"Machine Learning &amp; AI\",\"Technology\",\"Tools &amp; Software\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/\",\"url\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/\",\"name\":\"Top 15 Interesting Tricks a Python Beginner Must Know | Ivy Pro School\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/Cover.png\",\"datePublished\":\"2020-04-02T10:56:06+00:00\",\"dateModified\":\"2021-06-11T06:10:04+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#\\\/schema\\\/person\\\/31fdab8559dd3db99173764bfb60215d\"},\"description\":\"Top 15 Tricks that every Python beginner must know. Read the article to know what those tricks are. Get Started on Python with Ivy Pro School.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/#primaryimage\",\"url\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/Cover.png\",\"contentUrl\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/Cover.png\",\"width\":1080,\"height\":500,\"caption\":\"Top 15 tricks every python beginner must know\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/top-15-interesting-tricks-every-python-beginner-must-know\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Top 15 Interesting Tricks Every Python Beginner Must Know\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/\",\"name\":\"Ivy Professional School | Official Blog\",\"description\":\"Confused between R and Python for your data science journey? Discover the key differences in data visualization, handling capabilities, speed, and ease of learning.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/#\\\/schema\\\/person\\\/31fdab8559dd3db99173764bfb60215d\",\"name\":\"Ivy Professional School\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g\",\"caption\":\"Ivy Professional School\"},\"sameAs\":[\"http:\\\/\\\/www.ivyproschool.com\",\"https:\\\/\\\/facebook.com\\\/ivyproschool\",\"https:\\\/\\\/instagram.com\\\/ivyproschool\",\"https:\\\/\\\/x.com\\\/ivyproschool\",\"https:\\\/\\\/youtube.com\\\/ivyproschool\"],\"url\":\"https:\\\/\\\/ivyproschool.com\\\/blog\\\/author\\\/prateek\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Top 15 Interesting Tricks a Python Beginner Must Know | Ivy Pro School","description":"Top 15 Tricks that every Python beginner must know. Read the article to know what those tricks are. Get Started on Python with Ivy Pro School.","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:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/","og_locale":"en_US","og_type":"article","og_title":"Top 15 Interesting Tricks a Python Beginner Must Know | Ivy Pro School","og_description":"Top 15 Tricks that every Python beginner must know. Read the article to know what those tricks are. Get Started on Python with Ivy Pro School.","og_url":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/","og_site_name":"R vs Python: Which Analytics Tool Should You Choose for Data Science?","article_author":"https:\/\/facebook.com\/ivyproschool","article_published_time":"2020-04-02T10:56:06+00:00","article_modified_time":"2021-06-11T06:10:04+00:00","og_image":[{"width":1080,"height":500,"url":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover.png","type":"image\/png"}],"author":"Ivy Professional School","twitter_card":"summary_large_image","twitter_creator":"@ivyproschool","twitter_misc":{"Written by":"Ivy Professional School","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/#article","isPartOf":{"@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/"},"author":{"name":"Ivy Professional School","@id":"https:\/\/ivyproschool.com\/blog\/#\/schema\/person\/31fdab8559dd3db99173764bfb60215d"},"headline":"Top 15 Interesting Tricks Every Python Beginner Must Know","datePublished":"2020-04-02T10:56:06+00:00","dateModified":"2021-06-11T06:10:04+00:00","mainEntityOfPage":{"@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/"},"wordCount":900,"commentCount":0,"image":{"@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/#primaryimage"},"thumbnailUrl":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover.png","keywords":["Artificial Intelligence","Big Data","data science","Filter","Join","Map","predictive analytics","python","Reduce","Reverse","Split","Swap"],"articleSection":["Business Analytics","Data Analytics","Data Science","Machine Learning &amp; AI","Technology","Tools &amp; Software"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/","url":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/","name":"Top 15 Interesting Tricks a Python Beginner Must Know | Ivy Pro School","isPartOf":{"@id":"https:\/\/ivyproschool.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/#primaryimage"},"image":{"@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/#primaryimage"},"thumbnailUrl":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover.png","datePublished":"2020-04-02T10:56:06+00:00","dateModified":"2021-06-11T06:10:04+00:00","author":{"@id":"https:\/\/ivyproschool.com\/blog\/#\/schema\/person\/31fdab8559dd3db99173764bfb60215d"},"description":"Top 15 Tricks that every Python beginner must know. Read the article to know what those tricks are. Get Started on Python with Ivy Pro School.","breadcrumb":{"@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/#primaryimage","url":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover.png","contentUrl":"https:\/\/ivyproschool.com\/blog\/wp-content\/uploads\/2015\/08\/Cover.png","width":1080,"height":500,"caption":"Top 15 tricks every python beginner must know"},{"@type":"BreadcrumbList","@id":"https:\/\/ivyproschool.com\/blog\/top-15-interesting-tricks-every-python-beginner-must-know\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ivyproschool.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Top 15 Interesting Tricks Every Python Beginner Must Know"}]},{"@type":"WebSite","@id":"https:\/\/ivyproschool.com\/blog\/#website","url":"https:\/\/ivyproschool.com\/blog\/","name":"Ivy Professional School | Official Blog","description":"Confused between R and Python for your data science journey? Discover the key differences in data visualization, handling capabilities, speed, and ease of learning.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ivyproschool.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ivyproschool.com\/blog\/#\/schema\/person\/31fdab8559dd3db99173764bfb60215d","name":"Ivy Professional School","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/866b09293f13d461b399bb9a40607e85623ede13d844f763bf665689cb0d1452?s=96&d=mm&r=g","caption":"Ivy Professional School"},"sameAs":["http:\/\/www.ivyproschool.com","https:\/\/facebook.com\/ivyproschool","https:\/\/instagram.com\/ivyproschool","https:\/\/x.com\/ivyproschool","https:\/\/youtube.com\/ivyproschool"],"url":"https:\/\/ivyproschool.com\/blog\/author\/prateek\/"}]}},"_links":{"self":[{"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/posts\/9691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/comments?post=9691"}],"version-history":[{"count":1,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/posts\/9691\/revisions"}],"predecessor-version":[{"id":10573,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/posts\/9691\/revisions\/10573"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/media\/9696"}],"wp:attachment":[{"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/media?parent=9691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/categories?post=9691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ivyproschool.com\/blog\/wp-json\/wp\/v2\/tags?post=9691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}