Python Lesson 1- Hello World to Python!

Python—the popular and highly readable object-oriented language—is both powerful and relatively easy to learn. Whether you're new to programming or an experienced developer, this course can help you get started with Python. We are going to see basic Python syntax, and an example of how to construct and run a simple Python program. Learn to work with dates and times, read and write files, and retrieve and parse HTML, JSON, and XML data from the web.

Topics include:
  1. Parsing and processing HTML
  2. Intro to python(We are going to cover in this lesson)
  3. Working with variables and expressions
  4. Writing loops
  5. Using the date, time, and datetime classes
  6. Reading and writing files
  7. Fetching internet data

Install Python

This Step is covered most of the time on internet. You can find the best resource to install python on your own.

How to check the python version?

## SYS module provides access to some variables used or maintained by the interpreter(To interact with) 

import sys
3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]

The above statements prints the build number and build date.

How to print something in python ?

Print "Hello world" ### Oops...Is that correct ?
  File "", line 1
    Print "Hello world" ### Oops...Is that correct ?
SyntaxError: invalid syntax

print("Hello World!") ###Yay!

Hello World!

def main():
    print("Hello World!")

Hello World!

if __name__=="__main__":  ###This works
Hello World!

What does if name == “main”: do?

When the Python interpreter reads a source file, it executes all of the code found in it. Before executing the code, it will define a few special variables. For example, if the Python interpreter is running that module (the source file) as the main program, it sets the special name variable to have a value "main". If this file is being imported from another module, name will be set to the module's name.

# file
def func():
    print("func() is n")

print("I am in")

if __name__ == "__main__":
    print(" is being run directly")
    print(" is being imported into another module")

Hey I'm Venkat
Developer, Blogger, Thinker and Data scientist. nintyzeros [at] I love the Data and Problem - An Indian Lives in US .If you have any question do reach me out via below social media