2

What The Heck Is Python? Executive Summary!

 3 years ago
source link: https://blog.knoldus.com/what-the-heck-python/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Reading Time: 2 minutes

Python is an easy to learn, powerful programming language and object-oriented programming language created by Guido van Rossum. It wasn’t named after a dangerous snake 😛 . Rossum was the fan of a comedy series from the late seventies. The name “Python” was adopted from the same series “Monty Python’s Flying Circus”.

Python

Everything in Python is an object. Sites like Mozilla, Reddit and Instagram are written in Python.

3 Reasons why to Choose Python as First Language

  • Simple Elegant Syntax – It is easier to understand and write python code.

number1 = 5

number2 = 6

multiply = number1 * number2

print(multiply)

  • Not overly strict – Neither there is a need to define type in python nor it is necessary to add a semicolon at the end. But Python enforces you to follow proper indentation as a good practice
  • Expressiveness of the language – Python allows you to write programs having greater functionality with fewer lines of code.

How to Install Python on Ubuntu

  • To make sure that our versions are up-to-date, let’s update and upgrade the system with apt-get:

$ sudo apt-get update
$ sudo apt-get -y upgrade

  • By default, Python comes preinstalled in Ubuntu. But if you want to update Python you can follow the following instructions.
  • Go to the official site of Python and click on Download Python 3.6.1.
  • Now, go to the directory where the file is downloaded and run the command to extract the .tar Python:

$ tar -xvf Python-3.6.1.tar.xz

  • Go to the extracted Directory of Python:

$ cd Python-3.6.1

  • Issue the following commands to compile Python source code on your Operating system.

$ ./configure
$ make
$ sudo make altinstall

  • As a newbie we recommend you to install sublime text in ubuntu and the commands are:

$ sudo add-apt-repository -y ppa:webupd8team/sublime-text-2
$ sudo apt-get update
$ sudo apt-get install sublime-text

  • Open Sublime text. To create a new file, go to File > New File (Shortcut: Ctrl+N).
  • Save the file with .py file extension as primeNumber.py.
  • Write the code and save it (Ctrl+S or File > Save). For starters, you can copy the code below:

def prime(number):

for a in range(2, number+1):

if number % a & number != a:

return true

else:

return false

  • Go to Tool > Build (Shortcut: Ctrl+B). You will see the output at the bottom of Sublime Text. Congratulations, you’ve successfully run your first Python program.

You can refer to my Python repository for some basic understanding of how to code in python: Python Programming for beginners

Happy Coding!! 🙂


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK