{"id":3613,"date":"2021-07-02T10:03:15","date_gmt":"2021-07-02T09:03:15","guid":{"rendered":"https:\/\/statanalytica.com\/blog\/?p=3613"},"modified":"2024-01-19T10:01:04","modified_gmt":"2024-01-19T10:01:04","slug":"python-fundamentals","status":"publish","type":"post","link":"https:\/\/statanalytica.com\/blog\/python-fundamentals\/","title":{"rendered":"6 Assertive Python Fundamentals for Beginners"},"content":{"rendered":"\n<p>Here in this blog we are going to cover python fundamentals. Are you willing to learn python for a better future in the programming field?<\/p>\n\n\n\n<p>If yes, you are on the right track. Python is the best way to start your journey of programming.<\/p>\n\n\n\n<p>Python is the most accepted and demanding language in the field of data science. So, if you are thinking of becoming a data scientist, python is a great skill for you.<\/p>\n\n\n\n<p>The benefit of starting your programming learning with python is that it does not require any prior knowledge of coding.<\/p>\n\n\n\n<p>But to learn python efficiently, you need to strengthen your basics. Without investing your time on basics you can\u2019t do good with python.<\/p>\n\n\n\n<p>&nbsp;In this blog, we will explore Assertive python fundamentals for beginners that will help you to excel in this most valuable field.<\/p>\n\n\n\n<p>Let&#8217;s start with the meaning of python.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"why-is-python-known-as-python\"><\/span><strong>Why is python known as python?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f2d05101391\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ff5104;color:#ff5104\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ff5104;color:#ff5104\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f2d05101391\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#why-is-python-known-as-python\" >Why is python known as python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#what-is-python\" >What is python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#python-fundamentals\" >Python Fundamentals<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#statements\" >Statements<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#assignment-statements\" >Assignment Statements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#multiline-statement\" >Multiline Statement<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#2-indentation\" >2. Indentation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#3-comments\" >3. Comments<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#4-variables\" >4. Variables<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#5-constants\" >5. Constants<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#also-read\" >Also Read<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#6-tokens\" >6. Tokens<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#4-operators\" >4. Operators<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#assignment-operators\" >Assignment Operators<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#logical-operators\" >Logical Operators<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#membership-operators\" >Membership Operators<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#bitwise-operators\" >Bitwise Operators<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#frequently-asked-questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#what-are-the-features-of-python\" >What are the features of Python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#how-much-time-does-it-take-to-learn-python-fundamentals\" >How much time does it take to learn Python Fundamentals?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/statanalytica.com\/blog\/python-fundamentals\/#how-to-learn-python\" >How to learn Python?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n\n<p>Have you ever thought about why python is called python?<\/p>\n\n\n\n<p>Or<\/p>\n\n\n\n<p>&nbsp;Why the logo of a python representing a large snake?<\/p>\n\n\n\n<p>Actually, the python name comes from a comedy sketch series(Monty Python&#8217;s Flying Circus) on BBC television. This show was very creative and well, so the developer was inspired by this name and developed the language by the python name.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"what-is-python\"><\/span><strong>What is python?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python is a high level programming language developed in 1991 by Guido Van Rossum.<\/p>\n\n\n\n<p>It is an object-oriented language and general-purpose language widely used in web development, scientific computing, etc.<\/p>\n\n\n\n<p>Nowadays, Python is more popular than Java because of its simplicity and wide applications.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"python-fundamentals\"><\/span><strong>Python Fundamentals<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Fundamentals of Python involve basic building blocks of the Python programming language. As fundamentals of Python we are going to discuss about 13 assertive python fundamentals.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Statements<\/li>\n\n\n\n<li>Indentations<\/li>\n\n\n\n<li>Comments<\/li>\n\n\n\n<li>Variables<\/li>\n\n\n\n<li>Constants<\/li>\n\n\n\n<li>Tokens<\/li>\n\n\n\n<li>&nbsp;Operators<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"statements\"><\/span><strong>Statements<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Statements are logical instructions to read and execute by the interpreter. The statement can be single or multiple.<\/p>\n\n\n\n<p>In Python, statements are of two types.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Expression Statements<\/li>\n\n\n\n<li>Assignments Statements<\/li>\n<\/ul>\n\n\n\n<p><strong>Expression Statement:<\/strong> Expression statements are used to perform operations such as addition, division, subtraction, etc.<\/p>\n\n\n\n<p>These statements are considered as expressions when they appear on the right side of an assignment and appear as a parameter to a method call.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><br><strong>Remember:<\/strong> An expression should give a return value.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Let&#8217;s understand it by taking examples.<\/p>\n\n\n\n<p><strong>Case 1-<\/strong> When we use a simple arithmetic expression.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>(2+6)*4&nbsp;<br>32<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Case 2- <\/strong>When we need to use a function in an expression.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>div (4,2)<br>2<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"assignment-statements\"><\/span><strong>Assignment Statements<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>When we have to assign values, change values and create new values, assignment statements help us.<\/p>\n\n\n\n<p><strong>Syntax of Assignment Statement<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td># LHS &lt;=&gt; RHS<br>variable = expression<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Assignment statements are further divided into 3 categories on the basis of value-based expression, current variable, and operation on the statement&#8217;s right-hand side.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Value-Based Expression on RHS<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Here, when we need to assign a new variable, Python allocates a new memory location to this variable.&nbsp;<\/p>\n\n\n\n<p>Steps to check memory location-<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Firstly, we will create a string and assign this string to a variable &#8220;var&#8221;<\/li>\n\n\n\n<li>Then we will check the given memory location id for the variable.<\/li>\n<\/ol>\n\n\n\n<p>Let&#8217;s understand it with a program-<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>var=&#8221;Guido Van Rossum&#8221;id(var)print(id(var))<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Examples<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>var1=&#8221;Guido&#8221;id(var1)print(id(var1))<br>output-139623763211824<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>var2=&#8221;Guido&#8221;id(var2)print(id(var2)<br>output-139623763211824<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Have you noticed Python allocates the same memory location for the same string into two different variables?<\/p>\n\n\n\n<p>Do you know the reason?<\/p>\n\n\n\n<p>&nbsp;Ok, I am telling you why?<\/p>\n\n\n\n<p>When the characters in the string are less than 20 without white spaces, and if the integer ranges from -5 to +255, the Python allocates the same memory by Python and is known as interning.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Current Python variable on RHS<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Python does not allow a new memory location in this case.<\/p>\n\n\n\n<p><strong>Example-<\/strong><\/p>\n\n\n\n<p>current_var=&#8221;it&#8217;s about learning python&#8221;<\/p>\n\n\n\n<p>print(id(current_var))<\/p>\n\n\n\n<p>new_var=current_var<\/p>\n\n\n\n<p>print(id(new_var))<\/p>\n\n\n\n<p>Output-<\/p>\n\n\n\n<p>140264590697072<\/p>\n\n\n\n<p>140412047716976<\/p>\n\n\n\n<p>Now, you can notice that for the two different variables, we have the same location id.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Operation on RHS<\/strong><\/li>\n<\/ul>\n\n\n\n<p>In this case we have an operation (a defining factor of the type of our statement) on the right side of the statement.<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<p>test=4*3<\/p>\n\n\n\n<p>type(test)<\/p>\n\n\n\n<p>int<\/p>\n\n\n\n<p>test1=4*3\/5<\/p>\n\n\n\n<p>type(test1)<\/p>\n\n\n\n<p>Output-<\/p>\n\n\n\n<p>float<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"multiline-statement\"><\/span><strong>Multiline Statement<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>We can define multiline statements in two ways.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Implicit Method<\/li>\n\n\n\n<li>Explicit Method<\/li>\n<\/ul>\n\n\n\n<p>The ending point of any statement in Python is taken as a newline character, and for the extension of a statement in multiple lines, two methods we can use.<\/p>\n\n\n\n<p><strong>Implicit Method:<\/strong> You can use parenthesis, ( ),{ }, and [ ].<\/p>\n\n\n\n<p>Example-<\/p>\n\n\n\n<p>x= (0+2+4+6+<\/p>\n\n\n\n<p>8+10)<\/p>\n\n\n\n<p><strong>Explicit Method:<\/strong> You can use the continuation character, \\&#8217;.<\/p>\n\n\n\n<p>x= 1+3+5+ \\<\/p>\n\n\n\n<p>7+9<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2-indentation\"><\/span><strong>2. Indentation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In python programming, we use indentation to mark a set of code. The indent size should be four as per python style guidelines or PEP8(Python Enhancement Proposal).<\/p>\n\n\n\n<p>Indentation is necessary for Python, unlike other programming languages.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/-wewnTGxURo9iVQfj0Skan7ikFKXtXL6iGOlzsETP3P3BFkP3eE9Xc2hKNDdkj32EDkx9gsCIsZJln6cpyqIxQy_QRPmx5Kp-wriS_twbZl_jslZkxxvBLkRS1zVYtstsDZ9BND9\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/strong><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Different blocks of code<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3-comments\"><\/span><strong>3. Comments<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Comments are the tagged lines of codes to increase the readability of the code. The main purpose of using taglines is to make the code self-explanatory.<\/p>\n\n\n\n<p>Comments are of two types-<\/p>\n\n\n\n<p>Single line comment<\/p>\n\n\n\n<p>Multiple line comment<\/p>\n\n\n\n<p><strong>Single line comment<\/strong><\/p>\n\n\n\n<p>We start a single-line comment with the help of single # simbol.<\/p>\n\n\n\n<p>for example-<\/p>\n\n\n\n<p>var=2*4<\/p>\n\n\n\n<p>type(var)<\/p>\n\n\n\n<p># single-line comment<\/p>\n\n\n\n<p><strong>Multiline Comments<\/strong><\/p>\n\n\n\n<p>We can write multiple comments in Python by using &#8220;&#8230;&#8221;.<\/p>\n\n\n\n<p>For example-<\/p>\n\n\n\n<p>var1=4*2\/5<\/p>\n\n\n\n<p>type(var1)<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p>comment line 1<\/p>\n\n\n\n<p>comment line 2<\/p>\n\n\n\n<p>comment line 3<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p><strong>Docstring Comments<\/strong><\/p>\n\n\n\n<p>It is a characteristic of Python to have a docstring or documentation string. It assists the programmer in adding quick notes in every module, function, class and method of Python.<\/p>\n\n\n\n<p>We can define the string by using triple quotation marks (multiple comments)<\/p>\n\n\n\n<p>If a string is placed just after a function, class definition, and on the top of a module, they will be considered as the docstring.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4-variables\"><\/span><strong>4. Variables<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It is a memory address that we can change. A Variable is like a container where the data is stored. When we store the variable, it occupies the space in memory.&nbsp;<\/p>\n\n\n\n<p>A variable can be a number, letter, and underscore character. Such as i=1 or a=2.<\/p>\n\n\n\n<p>If we can not change the variable, it is called constant. Python identifies the type of assigned variable because it is a type inferred language.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5-constants\"><\/span><strong>5. Constants<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In Python, we rarely use the constants. It is a variable type that keeps values in it and can not be changed.&nbsp;<\/p>\n\n\n\n<p>Such as the value of a trigonometric function sin 90=1<\/p>\n\n\n\n<p>and value of a light year= 9.46 *10^12 Km.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"also-read\"><\/span>Also Read<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/statanalytica.com\/blog\/how-to-create-module-in-python\/\">How To Create Module In Python <\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/statanalytica.com\/blog\/k-means-clustering-python\/\">How to Perform K means clustering Python?<\/a><\/li>\n\n\n\n<li>How to do Python Programming Practice Effectively?<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6-tokens\"><\/span><strong>6. Tokens<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Tokens are considered as the smallest unit of the program and are of 4 types.&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Reserved Words(Keywords)-<\/strong> Reserved words are fixed and special words in Python that convey a particular meaning. We can not use keywords as a variable in Python because Python is case-sensitive.<\/li>\n<\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><strong>Identifiers-<\/strong> These are the names defined by the users to express entities we can use in programs such as functions, classes, modules, variables and other objects.<\/li>\n<\/ol>\n\n\n\n<p>We need to follow some rules when we are going to define identifiers.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When you are defining an identifier, you can use a series\/sequence of letters in lowercase or uppercase. In addition, you can add digit numbers from 0 to 1 or an underscore.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>At the start of the name of an identifier, don&#8217;t use digit numbers.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You are prohibited from using reserved words to express an identifier.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Name the identifier within 79 characters as PEP8 guidelines.<\/li>\n<\/ul>\n\n\n\n<p><strong>3.Literals-<\/strong> Literals can be represented as data provided in a variable or constant. Python offers 5 literals.<\/p>\n\n\n\n<p><strong>String Literals- <\/strong>It is a sequence of characters that is surrounded by single, double, and triple quotes for a string.<\/p>\n\n\n\n<p><strong>Numeric Literals<\/strong>&#8211; Numeric literals are unalterable such as integers, float, and complex.<\/p>\n\n\n\n<p><strong>Boolean Literals<\/strong>&#8211; True and false values are known as boolean literals.<\/p>\n\n\n\n<p><strong>Collection Literals-<\/strong> Collection literals are List, Tuple, Dic and Set literals.<\/p>\n\n\n\n<p><strong>Special Literals-<\/strong> we use None as a special literal that says field is not created.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4-operators\"><\/span><strong>4. Operators<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Operators are the different symbols that are responsible for performing the operations for operands(values). In Python, we use seven types of operators.<\/p>\n\n\n\n<p><strong>Arithmetic Operators<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Operator<\/strong><\/td><td><strong>Function<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td><strong>+<\/strong><\/td><td>It perform the addition operation<\/td><td>i=5j=6I+j=11<br><\/td><\/tr><tr><td><strong>&#8211;<\/strong><\/td><td>It is used to perform subtraction tasks.<\/td><td>i=10j=7i-j=3<\/td><\/tr><tr><td><strong>*<\/strong><\/td><td>Multiplication task<\/td><td>i=3j=4i*j=12<\/td><\/tr><tr><td><strong>\/<\/strong><\/td><td>Division<\/td><td>i=8j=4i\/j=2<\/td><\/tr><tr><td><strong>%<\/strong><\/td><td>Modulus(gives the remainder after division)<\/td><td>i=6j=3i%j=0<\/td><\/tr><tr><td><strong>**<\/strong><\/td><td>Exponential(power calculation)<\/td><td>i=5j=3i**j=5^3<\/td><\/tr><tr><td><strong>\/\/<\/strong><\/td><td>Floor division(remove decimal value return quotient value)<\/td><td>i=5j=2i\/\/j=1<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Relational Operators<\/strong><\/p>\n\n\n\n<p>These are also known as comparison operators as they compare the values. After comparison of the values it returns true or false values.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Operator<\/strong><\/td><td><strong>Function<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td>==<\/td><td>If operands are equal, true<\/td><td>i=5j=5i==jTrue<\/td><\/tr><tr><td>!=<\/td><td>True, when values of operand are not equal<\/td><td>i=4j=7i!=jtrue<\/td><\/tr><tr><td>&lt;<\/td><td>Less thanTrue,If the value of left operand less than the&nbsp; value of right operand<\/td><td>i=6j=7i&lt;jtrue<\/td><\/tr><tr><td>&gt;<\/td><td>Greater thanTure,If the value of the left operand is greater than the value of the right operand.<\/td><td>i=8j=6i&gt;jtrue<\/td><\/tr><tr><td>&lt;=<\/td><td>Less than or equal toTrue,If the value of the left operand is less than or equal to the value of the right operand.<\/td><td>i=5j=4i&lt;=jTrue<\/td><\/tr><tr><td>&gt;=<\/td><td>Greater than or equal toTrue, if the value of the left operand is greater than or equal to the value of the right operand.<\/td><td>i=5j=7i&gt;=jFalse<\/td><\/tr><tr><td>&lt;&gt;<\/td><td>Not equal to<\/td><td>i=10j=15i&lt;&gt;jTrue<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"assignment-operators\"><\/span><strong>Assignment Operators<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Operator<\/strong><\/td><td><\/td><td><strong>Function<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td>=<\/td><td><\/td><td>(Assignment)It assigns value from right side operand to left side operand<\/td><td>i= 15It will assign 15 to i<\/td><\/tr><tr><td>+=<\/td><td><\/td><td>(Add then assign)First it performs an addition,then assigns the result to the left hand operand.<\/td><td>i+=jthat says i= i+ j<\/td><\/tr><tr><td>-=<\/td><td><\/td><td>(Subtract then assign)After subtraction, it assigns the result to the left operand.&nbsp;<\/td><td>i-=jthat says i = i \u2013 j<\/td><\/tr><tr><td>*=<\/td><td><\/td><td>(Multiply then assign)The result is assigned to the left operand after multiplication.<\/td><td>i*=jthat says i= i * j<\/td><\/tr><tr><td>\/=<\/td><td><\/td><td>(Divide then assign)After division, the result is assigned to the left operand.<\/td><td>i\/=jthat says I = i\/ j<\/td><\/tr><tr><td>%=<\/td><td><\/td><td>(Modulus then assign)It assigns the result to the left operand after modulus.<\/td><td>i%=jthat says i = i% J<\/td><\/tr><tr><td>**=<\/td><td><\/td><td>(Exponent then assign)Initially performs exponent and then result is assigned to left hand operand<\/td><td>i**=jthat says i = i** j<\/td><\/tr><tr><td>\/\/=<\/td><td><\/td><td>(Floor Division then assign)It performs floor division and then result is assigned to left hand operand<\/td><td>i\/\/=jthat says i = I \/\/ j<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"logical-operators\"><\/span><strong>Logical Operators<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Operator<\/strong><\/td><td><\/td><td><strong>Function<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td>and<\/td><td><\/td><td>(Logical AND)True,when Both side conditions are true, otherwise false.<\/td><td>3&lt;2 and 4&lt;5False<\/td><\/tr><tr><td>or<\/td><td><\/td><td>(Logical OR)True, when at least one condition is true, otherwise false&nbsp;<\/td><td>5&lt;2 or 6&lt;8True<\/td><\/tr><tr><td>not<\/td><td><\/td><td>Logical NOTIt the condition is reverse<\/td><td>Not (10&gt;6)False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"membership-operators\"><\/span><strong>Membership Operators<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Operator<\/strong><\/td><td><strong>&nbsp; &nbsp; Function<\/strong><\/td><td><\/td><\/tr><tr><td>in<\/td><td>True, When values are in sequence.&nbsp;<\/td><td><\/td><\/tr><tr><td>not in<\/td><td>True, when values are not in sequence.<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"bitwise-operators\"><\/span><strong>Bitwise Operators<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>It performs the operations bit by bit.<\/p>\n\n\n\n<p>For example we have two variables,<\/p>\n\n\n\n<p>i=5<\/p>\n\n\n\n<p>j=10<\/p>\n\n\n\n<p>and their binary values are-<\/p>\n\n\n\n<p>i = 5 = 0101<\/p>\n\n\n\n<p>J = 10 = 1010<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Operator<\/strong><\/td><td><strong>Function<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td>&amp;<\/td><td>(Binary AND)It is 1, when both the bits are 1, otherwise it will be 0<\/td><td>i&amp;j0000 0000<br>0<\/td><\/tr><tr><td>|<\/td><td>(Binary OR)It is 1, when one of the bits is 1 otherwise 0.<\/td><td>I&nbsp; | j0100 0011<br>1<\/td><\/tr><tr><td>^<\/td><td>(Binary XOR)It is 0, when both the values are the same,otherwise 1.<\/td><td>i^j0101 1100<br>1<\/td><\/tr><tr><td>~<\/td><td>(Binary Complement)In this we have to interchange the values, if it is 0 make it 1, if it is 1 then make it 0.<\/td><td>i~j1001 1101<br>0110 0010<\/td><\/tr><tr><td>&lt;&lt;<\/td><td>(Binary left shift)Here, Number of bits specified by the right operand moves the left operand to left.<\/td><td>i&lt;&lt;j240&nbsp;Binary value1111 0000<\/td><\/tr><tr><td>&gt;&gt;<\/td><td>(Binary right shift)Left operand is moved to the right by the bits specified by the right operand.<\/td><td>i&gt;&gt;j150000 1111<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Identity Operators<\/strong><\/p>\n\n\n\n<p>When we need to compare the memory address of two objects, we use identity operators.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Operator<\/strong><\/td><td><strong>Function<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td>is<\/td><td>It shows true, when the identity of&nbsp; both operands is the same, otherwise false.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>i=10j=10true<\/td><\/tr><tr><td>Is not<\/td><td>True, when the identity of both operands is not equal, otherwise false.<\/td><td>i=10j=10False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>I hope now you know the basics of Python and are ready to step ahead on the way to your success. To learn Python, you do not need to be afraid about your prior knowledge of coding. You can start it as your first programming language then go to a complex one.<\/p>\n\n\n\n<p>In this blog, we have provided you with python fundamentals, which are the building blocks of Python. The plus point is this language is very simple and easy to learn and run. Python has a big role in the data science field, so to excel in this field, learn this valuable language. Get the best <a href=\"https:\/\/statanalytica.com\/python-homework-help\">python programming homework help<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"frequently-asked-questions\"><\/span>Frequently Asked Questions <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-611750bda1cb2\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"what-are-the-features-of-python\"><\/span><strong>What are the features of Python?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Unlike other languages such as C and its extensions, Python is an interpreted language. It implies that there is no need to compile the program before running it. Other than that, it is dynamically typed, fast and object-oriented.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-611750bda1cb4\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"how-much-time-does-it-take-to-learn-python-fundamentals\"><\/span><strong>How much time does it take to learn Python Fundamentals?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>It depends on factors such as your interest, grasping speed, environment, and practice. If you do regular practice with dedication, you can clear your basics within one month or less.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-611750bda1cb5\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"how-to-learn-python\"><\/span><strong>How to learn Python?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>There are various sources where you can learn this demanding language. You can go for online courses and YouTube tutorials if you want to learn it on your own. Otherwise, you can do any degree or diploma in this field from a college or any university.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Here in this blog we are going to cover python fundamentals. Are you willing to learn python for a better future in the programming field? If yes, you are on the right track. Python is the best way to start your journey of programming. Python is the most accepted and demanding language in the field [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3614,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[138],"tags":[686,433,685],"class_list":["post-3613","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","tag-python-fundamentals","tag-python-programming","tag-python-programming-fundamentals"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/posts\/3613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/comments?post=3613"}],"version-history":[{"count":0,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/posts\/3613\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/media\/3614"}],"wp:attachment":[{"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/media?parent=3613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/categories?post=3613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/tags?post=3613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}