uqutub / python-baby-steps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Learn Python

Python is a very simple language, and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code. The simplest directive in Python is the "print" directive - it simply prints out a line (and also includes a newline, unlike in C).

There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different. This tutorial uses Python 2, because it is more widely used and supported. However, Python 3 is more semantically correct, and supports newer features.

For example, one difference between Python 2 and 3 is the print statement. In Python 2, the "print" statement is not a function, and therefore it is invoked without parentheses. However, in Python 3, it is a function, and must be invoked with parentheses.

Example of print in Python 2: print "Hello World!" Example of print in Python 3: print ("Hellow World")

for learning python3: https://learnxinyminutes.com/docs/python3/

Indentation

Python uses indentation for blocks, instead of curly braces. Both tabs and spaces are supported, but the standard indentation requires standard Python code to use four spaces.

Notes

  1. Extension of python file is .py
  2. To execute python file in linux syntax: python filename.py

About


Languages

Language:Python 100.0%