{"id":108,"date":"2018-03-29T09:25:11","date_gmt":"2018-03-29T09:25:11","guid":{"rendered":"https:\/\/www.go4expert.com\/tutorials\/?p=108"},"modified":"2018-03-30T09:57:49","modified_gmt":"2018-03-30T09:57:49","slug":"python-syntax","status":"publish","type":"post","link":"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/","title":{"rendered":"Python Basic Syntax"},"content":{"rendered":"<p>We are going to understand python syntax today. Now, every language has its set of rules also called as constructs. When you are starting to learn something, it is very important to follow those rules.<\/p>\n<p>Python Syntax and rules are very simple and easy to understand. It is like reading and writing simple English.<\/p>\n<h2><strong>Variables:<\/strong><\/h2>\n<p>We need to store values like the name of start-up or budget, and what can be a better place than the computer memory.<\/p>\n<p>And since we need that value to change as per our will, they are called as variables.<\/p>\n<p>By definition, a variable is the name of the memory location of a computer system.<\/p>\n<p>In python, we do not have to tell the variable whether it is going to be a number or characters, it just knows that and adjusts the memory size accordingly.<\/p>\n<h2>Variable declaration and Initialization<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-148\" src=\"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/Python-tutorials-Variable-Declaration-and-Initialization-Go4Expert-1.jpg\" alt=\"\" width=\"684\" height=\"433\" srcset=\"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/Python-tutorials-Variable-Declaration-and-Initialization-Go4Expert-1.jpg 684w, https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/Python-tutorials-Variable-Declaration-and-Initialization-Go4Expert-1-300x190.jpg 300w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><\/p>\n<p>Please note the memory is allocated to variables only when it is declared and initialized.<\/p>\n<p>Now let's try to declare some variables:<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88602517\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-python-variables-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"python-variables.py content, created by shabbirbhimani on 02:10PM on March 25, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"python-variables.py\">\n        <tr>\n          <td id=\"file-python-variables-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-python-variables-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># Creating the name of start up<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-python-variables-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-python-variables-py-LC2\" class=\"blob-code blob-code-inner js-file-line\"># there is no declaration what will be value or type<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-python-variables-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-python-variables-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-python-variables-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-python-variables-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">companyName = &quot;The New Verve&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-python-variables-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-python-variables-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">initalBudget = 15000<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-python-variables-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-python-variables-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">perDayWage = 12.34<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/5896a308e4f24a55f81b4b9e0b480050\/raw\/0962c0cafc6357d272b484746fd273051718f507\/python-variables.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/5896a308e4f24a55f81b4b9e0b480050#file-python-variables-py\" class=\"Link--inTextBlock\">\n          python-variables.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h3><strong>Rules for variable names:<\/strong><\/h3>\n<ol>\n<li>Python is case sensitive that means <strong>name <\/strong>and<strong> Name<\/strong> are two different variables.<\/li>\n<li>A variable name can include alphabets, numbers, and But It can only start with an alphabet or underscore.<\/li>\n<li>Variable names should follow camel case nomenclature. Our suggestion is to keep it for 2-3 words not more than that.<\/li>\n<\/ol>\n<p>For example - companyName, intitalBudget, workingHours<\/p>\n<h3>Camel Case Style for Variable Names<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-147\" src=\"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/Python-tutorials-Camel-case-nomenclature-for-variable-names-Go4Expert-1.jpg\" alt=\"\" width=\"830\" height=\"401\" srcset=\"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/Python-tutorials-Camel-case-nomenclature-for-variable-names-Go4Expert-1.jpg 830w, https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/Python-tutorials-Camel-case-nomenclature-for-variable-names-Go4Expert-1-300x145.jpg 300w, https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/Python-tutorials-Camel-case-nomenclature-for-variable-names-Go4Expert-1-768x371.jpg 768w\" sizes=\"auto, (max-width: 830px) 100vw, 830px\" \/><\/p>\n<h2><strong>Python Keywords:<\/strong><\/h2>\n<p>These are the reserved words that have pre-defined meaning in the system. They need to be used for their specific purpose only.<\/p>\n<p>You will get familiarized with them once we start using them in our programs.<\/p>\n<p>So, don\u2019t get overwhelmed by looking at them.<\/p>\n<ol>\n<li>\n<pre>and<\/pre>\n<\/li>\n<li>\n<pre>exec<\/pre>\n<\/li>\n<li>\n<pre>Not<\/pre>\n<\/li>\n<li>\n<pre>as<\/pre>\n<\/li>\n<li>\n<pre>finally<\/pre>\n<\/li>\n<li>\n<pre>or<\/pre>\n<\/li>\n<li>\n<pre>assert<\/pre>\n<\/li>\n<li>\n<pre>for<\/pre>\n<\/li>\n<li>\n<pre>pass<\/pre>\n<\/li>\n<li>\n<pre>break<\/pre>\n<\/li>\n<li>\n<pre>from<\/pre>\n<\/li>\n<li>\n<pre>print<\/pre>\n<\/li>\n<li>\n<pre>class<\/pre>\n<\/li>\n<li>\n<pre>global<\/pre>\n<\/li>\n<li>\n<pre>raise<\/pre>\n<\/li>\n<li>\n<pre>continue<\/pre>\n<\/li>\n<li>\n<pre>if<\/pre>\n<\/li>\n<li>\n<pre>return<\/pre>\n<\/li>\n<li>\n<pre>def<\/pre>\n<\/li>\n<li>\n<pre>import<\/pre>\n<\/li>\n<li>\n<pre>try<\/pre>\n<\/li>\n<li>\n<pre>del<\/pre>\n<\/li>\n<li>\n<pre>in<\/pre>\n<\/li>\n<li>\n<pre>while<\/pre>\n<\/li>\n<li>\n<pre>elif<\/pre>\n<\/li>\n<li>\n<pre>is<\/pre>\n<\/li>\n<li>\n<pre>with<\/pre>\n<\/li>\n<li>\n<pre>else<\/pre>\n<\/li>\n<li>\n<pre>lambda<\/pre>\n<\/li>\n<li>\n<pre>yield<\/pre>\n<\/li>\n<li>\n<pre>except<\/pre>\n<\/li>\n<\/ol>\n<h2><strong>Lines and Indentation:<\/strong><\/h2>\n<p>Python code is clean, and there is no place for semicolon (;). And neither python uses curly braces, but that also means that indentation is the most crucial factor.<\/p>\n<p>Spaces and tabs play the role of creating a block of code and are used to create readable code. We will explore this in future tutorials.<\/p>\n<p>For now, don\u2019t put spaces at starting of any line or else you will get an error.<\/p>\n<h2><strong>Comments:<\/strong><\/h2>\n<p>Comments are the lines followed by \u2018#\u2019 sign which program do not execute. These are going to be one of your best friends while programming.<\/p>\n<p>You may not remember why you have declared a variable, or a block of code, or what was the idea when you start to program.<\/p>\n<p>That\u2019s when comments come in handy. We encourage you to write comments while writing code.<\/p>\n<h2><strong>Input from user:<\/strong><\/h2>\n<p>So, till now we have, find a company name, start an initial budget and also gave per day wage. But, what about getting feedback from a friend?<\/p>\n<p>For this, there is a built-in function called as \u201cinput.\u201d Following is the syntax:<\/p>\n<p>Code for input:<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88602457\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-python-tutorials-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"python-tutorials.py content, created by shabbirbhimani on 02:02PM on March 25, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"python-tutorials.py\">\n        <tr>\n          <td id=\"file-python-tutorials-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-python-tutorials-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># Code for asking for feedback or input from a user<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-python-tutorials-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-python-tutorials-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-python-tutorials-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-python-tutorials-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">feedbackFriend = input(&quot;Do you like my idea? (yes\/no) : &quot;)<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/1d2bce510ec78aadf80435d42adb34dc\/raw\/098a665c03ad3ca23b9fa262cb83f71c236a32d8\/python-tutorials.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/1d2bce510ec78aadf80435d42adb34dc#file-python-tutorials-py\" class=\"Link--inTextBlock\">\n          python-tutorials.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<p>This will bring the cursor, and it will wait for user input.<\/p>\n<p>You can ask for any input,\u00a0 ask anything in double quotes (\u201c\u201d), and collect the input in a variable for future use. You are going to use this function a lot in IT company or your college projects. After all its all about the user.<\/p>\n<h2>Print output:<\/h2>\n<p>But wait, what if we want to know what is the feedback from the user or the value of a variable. For that purpose, we are going to use print function.<\/p>\n<p>Its syntax is print(\"\"). And anything inside double quotes will be print as it is.<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88603853\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-gistfile1-txt\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-text  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"gistfile1.txt content, created by shabbirbhimani on 04:29PM on March 25, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"gistfile1.txt\">\n        <tr>\n          <td id=\"file-gistfile1-txt-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-gistfile1-txt-LC1\" class=\"blob-code blob-code-inner js-file-line\"># Let&#39;s start with a ritual of programming by printing &quot;Hello World!&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-gistfile1-txt-LC2\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;Hello World&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-gistfile1-txt-LC3\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-gistfile1-txt-LC4\" class=\"blob-code blob-code-inner js-file-line\"># you can also print the values if you want by using print function<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-gistfile1-txt-LC5\" class=\"blob-code blob-code-inner js-file-line\"># print has the following syntax<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-gistfile1-txt-LC6\" class=\"blob-code blob-code-inner js-file-line\"># print(&quot;statement or information&quot;, variableName)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-gistfile1-txt-LC7\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-gistfile1-txt-LC8\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;company Name is&quot;, companyName)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-gistfile1-txt-LC9\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;Initial Budget is&quot;, initalBudget)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-gistfile1-txt-LC10\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;Per day Wage is&quot;, perDayWage)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-gistfile1-txt-LC11\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-gistfile1-txt-LC12\" class=\"blob-code blob-code-inner js-file-line\"># Let&#39;s print the value of feedback<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-gistfile1-txt-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-gistfile1-txt-LC13\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;Friend&#39;s feedback is : &quot;, feedbackFriend)<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/5884910d5d9da10739bc9ac11e1616e5\/raw\/a4c23010e731be77b0338248dc235d8b6d4cc169\/gistfile1.txt\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/5884910d5d9da10739bc9ac11e1616e5#file-gistfile1-txt\" class=\"Link--inTextBlock\">\n          gistfile1.txt\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h2><strong>Key Takeaways:<\/strong><\/h2>\n<ol>\n<li>Variables are declared to hold the values which we want to use in future. They have specific rules for naming them, and you should always adhere to them.<\/li>\n<li>Keywords are reserved words which are intended for certain<\/li>\n<li>Indentation is something that will make your code beautiful and will make a block of codes.<\/li>\n<li>Comments will make your life easier, so use them<\/li>\n<li>User input will make your programs interactive.<\/li>\n<li>You can print anything on screen using print function.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Python Syntax is very simple and easy to understand. It is like reading and writing simple English. In this tutorial, we are going to demonstrate how easy it is to declare a variable, print on the screen, and ask input from users. We will also highlight rules for variable names and python keywords.<\/p>\n","protected":false},"author":1,"featured_media":35,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":{"0":"post-108","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python","8":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Basic Syntax - Go4Expert Tutorials<\/title>\n<meta name=\"description\" content=\"Python Syntax is very simple and easy to understand. It is like reading and writing simple English. In this tutorial, we are going to demonstrate how easy it is to declare a variable, print on the screen, and ask input from users. We will also highlight rules for variable names and python keywords.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Basic Syntax - Go4Expert Tutorials\" \/>\n<meta property=\"og:description\" content=\"Python Syntax is very simple and easy to understand. It is like reading and writing simple English. In this tutorial, we are going to demonstrate how easy it is to declare a variable, print on the screen, and ask input from users. We will also highlight rules for variable names and python keywords.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/\" \/>\n<meta property=\"og:site_name\" content=\"Go4Expert Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-29T09:25:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-30T09:57:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"shabbir\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"shabbir\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/\",\"url\":\"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/\",\"name\":\"Python Basic Syntax - Go4Expert Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#website\"},\"datePublished\":\"2018-03-29T09:25:11+00:00\",\"dateModified\":\"2018-03-30T09:57:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/187ce4675295e6b09b98a9374ce2fec6\"},\"description\":\"Python Syntax is very simple and easy to understand. It is like reading and writing simple English. In this tutorial, we are going to demonstrate how easy it is to declare a variable, print on the screen, and ask input from users. We will also highlight rules for variable names and python keywords.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.go4expert.com\/tutorials\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Basic Syntax\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#website\",\"url\":\"https:\/\/www.go4expert.com\/tutorials\/\",\"name\":\"Go4Expert Tutorials\",\"description\":\"Programming And Web Development Tutorials\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.go4expert.com\/tutorials\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/187ce4675295e6b09b98a9374ce2fec6\",\"name\":\"shabbir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/303ce933c6bfabf6ac58bc870c696a1d5ef98012ecb820a4a7921853b813406f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/303ce933c6bfabf6ac58bc870c696a1d5ef98012ecb820a4a7921853b813406f?s=96&d=mm&r=g\",\"caption\":\"shabbir\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Basic Syntax - Go4Expert Tutorials","description":"Python Syntax is very simple and easy to understand. It is like reading and writing simple English. In this tutorial, we are going to demonstrate how easy it is to declare a variable, print on the screen, and ask input from users. We will also highlight rules for variable names and python keywords.","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:\/\/www.go4expert.com\/tutorials\/python-syntax\/","og_locale":"en_US","og_type":"article","og_title":"Python Basic Syntax - Go4Expert Tutorials","og_description":"Python Syntax is very simple and easy to understand. It is like reading and writing simple English. In this tutorial, we are going to demonstrate how easy it is to declare a variable, print on the screen, and ask input from users. We will also highlight rules for variable names and python keywords.","og_url":"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/","og_site_name":"Go4Expert Tutorials","article_published_time":"2018-03-29T09:25:11+00:00","article_modified_time":"2018-03-30T09:57:49+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/python.jpg","type":"image\/jpeg"}],"author":"shabbir","twitter_card":"summary_large_image","twitter_misc":{"Written by":"shabbir","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/","url":"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/","name":"Python Basic Syntax - Go4Expert Tutorials","isPartOf":{"@id":"https:\/\/www.go4expert.com\/tutorials\/#website"},"datePublished":"2018-03-29T09:25:11+00:00","dateModified":"2018-03-30T09:57:49+00:00","author":{"@id":"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/187ce4675295e6b09b98a9374ce2fec6"},"description":"Python Syntax is very simple and easy to understand. It is like reading and writing simple English. In this tutorial, we are going to demonstrate how easy it is to declare a variable, print on the screen, and ask input from users. We will also highlight rules for variable names and python keywords.","breadcrumb":{"@id":"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.go4expert.com\/tutorials\/python-syntax\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.go4expert.com\/tutorials\/python-syntax\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.go4expert.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Python Basic Syntax"}]},{"@type":"WebSite","@id":"https:\/\/www.go4expert.com\/tutorials\/#website","url":"https:\/\/www.go4expert.com\/tutorials\/","name":"Go4Expert Tutorials","description":"Programming And Web Development Tutorials","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.go4expert.com\/tutorials\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/187ce4675295e6b09b98a9374ce2fec6","name":"shabbir","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/303ce933c6bfabf6ac58bc870c696a1d5ef98012ecb820a4a7921853b813406f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/303ce933c6bfabf6ac58bc870c696a1d5ef98012ecb820a4a7921853b813406f?s=96&d=mm&r=g","caption":"shabbir"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/python.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9JSSi-1K","_links":{"self":[{"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":21,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":150,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/posts\/108\/revisions\/150"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/media\/35"}],"wp:attachment":[{"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}