Learn Python Programming Fast

Python Programming

Python is a high-level programming language. It was created by Guido van Rossum in late ’80s and released in early ’90s. The Python programming language is one of the easiest to learn, and also one of the most powerful languages in use today; it can be used for both large and small projects. Python has been adopted as an official language by Google, YouTube, IBM, and other companies because it can handle a variety of different projects within a rapid timeframe.

History of Python

This is a brief history of how various Python versions were introduced.

An edition of the Python language version 1.0 was released in February 1991, and it is still supported by the current release, Python 2.2, released in December 2001. The version of Python 3.4 was released in 2014 with significant changes coming from both a simplification and reorganisation of the language itself as well as introducing new features like async/await.

Stable version 3.9.5 was released on 3 May 2021 and the latest preview release 3.10.0b1 also 25 days ago.

Python Naming Mystery

Guido van Rossum announced the Python programming language in late 1989 and the origin of the name ‘Python’ is still a mystery.

The Python programming language has been developed by hundreds of contributors over its history. The Python community is active and welcoming to new developers. One can participate in the development community by attending PyCon conferences, or by contributing to mailing lists, code development, or documentation.

How to Learn Python Programming Fast

Python is easy to use. The best way to learn Python is by playing around with it. So, the best way to learn Python is simply get your hands dirty and start coding for real.

The official documentation contains step-by-step instructions and exercises to help you get started with Python programming in a hands-on manner. By following the short examples provided, you’ll quickly become familiar as how the language will work for you.

Learn Python Quickly by Examples

Print Hello World in Python

print("Hello, World!")

Variable handling

my_string = "awesome"
print("Python is " + my_string + "!")

String length

my_string = "Hello, World!"
print(len(my_string))

Substring

my_string = "Hello, World!"
print(my_string[0:5])

Append Item to a List

my_list = ["1st", "2nd", "3rd"]
my_list.append("4th")
print(my_list)

Remove Item from a List

my_list = ["1st", "2nd", "3rd"]
my_list.remove("2nd")
print(my_list)

If and Else in Python

x = 10
y = 20
if x > y:
print("x greater than y")
elif x == y:
print("x equals to y")
else:
print("y greater than x")

For Loop in Python

my_list = ["1st", "2nd", "3rd"]
for i in my_list:
print(i)

Function Calls in Python

def my_function():
print("Hello from my_function")
my_function()

Check if it is Prime or not in Python

x = 70
not_prime = False
if x > 1:
for i in range(2, x):
if (x % i) == 0:
not_prime = True
break
string = "yes, it is prime."
if not_prime:
string = "no, it is not prime."
print(string)

How to use Python Built-in Modules?

import platform
my_system = platform.system()
print(my_system)

How to Read a File in Python?

Note: readme.txt should exist or rename it.

my_file = open("readme.txt", "r")
print(my_file.read())

Print ASCII Character Table in Python

from functools import reduce
from itertools import chain
def Table():
return unlines(
concat(c.ljust(12, ' ') for c in xs) for xs in (
transpose(chunksOf(16)([Entry(n) for n in enumFromTo(32)(127)]))))
def Entry(n):
k = asciiName(n)
return k if '' == k else (concat([str(n).rjust(3, ' '), ' : ', k]))
def asciiName(n):
return '' if 32 > n or 127 < n else ('Spc' if 32 == n else (
'Del' if 127 == n else chr(n)))
def main():
print(Table())
def chunksOf(n):
return lambda xs: reduce(lambda a, i: a + [xs[i:n + i]],
range(0, len(xs), n), []) if 0 < n else []
def concat(xxs):
xs = list(chain.from_iterable(xxs))
unit = '' if isinstance(xs, str) else []
return unit if not xs else (''.join(xs) if isinstance(xs[0], str) else xs)
def enumFromTo(m):
return lambda n: list(range(m, 1 + n))
def splitAt(n):
return lambda xs: (xs[0:n], xs[n:])
def transpose(m):
if m:
inner = type(m[0])
z = zip(*m)
return (type(m))(map(inner, z) if tuple != inner else z)
else:
return m
def unlines(xs):
return '\n'.join(xs)
if __name__ == '__main__':
main()

Try out our Python examples here:

https://www.onlinegdb.com/online_python_interpreter

Free Complete Python Programming Language Courses

Libraries for Python

Python is a very extensible language. There are an overwhelming number of third-party modules and packages available for Python, which provide functionalities that go beyond the standard library. This not only makes Python very powerful and flexible, but also facilitates the future development of the language. Some of the popular libraries include:

NumPy

This package is designed for scientific computing using matrix and array algorithms. It has a high level of abstraction for mathematical expressions and handles a mix of numerical computations, data types, and interfaces that work together to solve a wide range of problems with Python.

SciPy

This is a collection of open-source libraries for mathematics, science, and engineering. SciPy’s modules include a core linear algebra component, numerical routines for computing derivatives, integrals, and other mathematical functions over continuous real numbers, high-precision computation and error estimates for scientific and engineering applications.
Matplotlib: This is used to create simple 2D plots using a library that will also work with many more advanced features such as 3D graphics.

Panda3D

This is a game engine that allows users to create their own 3D games through an object oriented interface. It provides interfaces for Python, C++, and C# so that it can be used with multiple programming languages.

Scikit-Learn

This open source machine learning library is integrated with NumPy/SciPy and uses the same syntax definition for all its algorithms so that they are easier to understand and to use. It is available on Windows, OS X, and Linux.

OpenCV

Developed by Intel, this open source library helps to build real-time computer vision applications and has Python bindings. Most of OpenCV’s source code is in C/C++, with some parts in Fortran. However, Python wrappers allow using OpenCV from python. Using this library you can get started in the world of computer vision. It also supports Windows, Mac OS X, Linux and Android.

IPython

Enables the interactive use of Python for computing and graphics. It is an enhanced version of the standard Python interpreter, with additional shell-like features, such as command completion and a customizable prompt. IPython also allows users to create interactive notebooks that combine code execution, text, mathematics and rich media content.

Popular Python IDE Tools

Python comes with a simple built-in text editor, but most programmers prefer using an integrated development environment (IDE). An IDE is a software application that provides a set of tools for programming including an editor, debugging facilities, and build support.

Here are some of the most popular IDEs for Python:

PyCharm

This IDE is based on JetBrains’ IntelliJ IDEA software and provides a simple interface, code assistance, and code analysis tools. It also allows users to run projects created with PyCharm in other standard Python IDEs.

Wing IDE

A Python development environment featuring a debugger, editor support for major version control systems, and an integrated IPython console. The Wing development environment is written in Python and uses web technologies.

KDevelop

A cross-platform, multi-language IDE for C++, C#, Objective-C, Lua and Python. Its IntelliJ based editor offers syntax highlighting for all supported languages (c++/c#/obj-c/lua/python), Google Code Search integration for code completion and download.

PyDev

A fully featured integrated development environment (IDE), based on Eclipse. Its primary goal is to offer Python developers the equivalent to the tools that they are used to.

IntelliJ IDEA

An IDE for Java, Groovy and other JVM languages as well as Python, PHP, Ruby, etc. It supports version control systems (CVS, Subversion (SVN), Mercurial (Hg), Git and Team Foundation Server (TFS)). IntelliJ has an extensible framework that allows great flexibility in adding new features.

PyScripter

An open source Python Integrated Development Environment (IDE) built specifically for the needs of professional Python developers, that makes writing and running Python code easier than ever before. It features a multi-window editor, syntax highlighting, remote development capabilities.

IDLE

A basic editor that comes bundled with the standard library. Although it does not have any special features, it’s a great way to start your programming career in Python.

WinPython

A Portable version of CPython and the core libraries, WinPython allows you to run Python programs on Windows without needing to install Python itself (or having to deal with the complexity of other Python implementations such as IronPython or Jython). WinPython also comes with all the basic modules of the standard CPython distribution, including easy_install built right in.

Cython

An optimizing static compiler for both the Python programming language and the extended Cython programming language.

IronPython

An implementation of the Python programming language designed to run on Microsoft’s .NET Framework.

Jython

Jython is an implementation of the Python programming language designed to run on the Java platform.

PyCrypto

A collection of cryptographic algorithms and protocols, implemented for use from Python.

PyPy

An alternative implementation of Python 2 written in a subset of Python, translated into C, then compiled. PyPy focuses mainly on speed and efficiency.

How to Begin Coding Python on Raspberry Pi

Python Community Resources

There are several online communities where you can go to get additional resources for learning and sharing your knowledge about Python.

Here are some of them:

Python Official Website: https://www.python.org/

Python Wiki: http://wiki.python.org/

Python Developer’s Guide: http://docs.python-guide.org/en/latest/index.html#toc3

Tutorials Point: http://www.tutorialspoint.com/python/ and http://www.learnpython.org/

Talk Python to Me: http://talkpython.fm

PyCon: http://pycon.org/

Python Weekly: http://www.pythonweekly.com/

The Future of the Python Programming Language

Python has a long history of being one of the most popular general-purpose, high-level programming languages. It’s been used for a lot of different kinds of applications and is currently being used in several fields from web development to network programming.

The future of Python is also looking bright. There are ongoing efforts to develop Python 3, which is the next generation of the language. These efforts have resulted in various improvements and new features which will make the Python 3 a much better language.

As for Python 2, it’s still very popular for web development, and you’ll probably continue to see it used in those applications as it will probably be supported until at least 2021.

Conclusion

The use of Python is expanding rapidly with more organizations taking notice of the language’s usefulness and popularity. If you are looking for a high-level language with powerful features that can be used on both the client-side and the backend, Python is an excellent choice.

One of its biggest selling points is also its simplicity. It’s easy to learn and you’ll get started in no time at all. If you’re looking to get into programming but aren’t sure where to start, consider Python 3. It’s easy enough that it would make a great starting point for those who have never written code before.

Most importantly, Python is flexible and extensible. There are a lot of third-party libraries available for it that you can use to extend its capabilities further.

Python has been around for more than 3 decades and is still being used in several different fields today. It’s unlikely that it will be phased out any time soon, as it provides a balance between high productivity and low overhead. That’s why Python continues to be one of the most popular languages today.

For more interesting articles, please read PC Ocular magazine regularly.

Benkő Attila is a Hungarian senior software developer, independent researcher and author of many computer science related papers.

1 thought on “Learn Python Programming Fast

Leave a Reply