Skip to main content

Python Introduction

 

Python Introduction




What is Python?

Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.

It is used for:

  • web development (server-side),
  • software development,
  • mathematics,
  • system scripting.

What can Python do?

  • Python can be used on a server to create web applications.
  • Python can be used alongside software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used for rapid prototyping, or for production-ready software development.

Why Python?

  • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
  • Python has a simple syntax similar to the English language.
  • Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
  • Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
  • Python can be treated in a procedural way, an object-oriented way or a functional way.

Good to know

  • The most recent major version of Python is Python 3, which we shall be using in this tutorial. However, Python 2, although not being updated with anything other than security updates, is still quite popular.
  • In this tutorial Python will be written in a text editor. It is possible to write Python in an Integrated Development Environment, such as Thonny, Pycharm, Netbeans or Eclipse which are particularly useful when managing larger collections of Python files.

Python Syntax compared to other programming languages

  • Python was designed for readability, and has some similarities to the English language with influence from mathematics.
  • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
  • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.

Example

print("Hello, World!")


                         NEXT


Comments

Post a Comment

Popular posts from this blog

Python Tuples

  Python  Tuples mytuple = ( "apple" ,  "banana" ,  "cherry" ) Tuple Tuples are used to store multiple items in a single variable. Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage. A tuple is a collection which is ordered and  unchangeable . Tuples are written with round brackets. Example Create a Tuple: thistuple = ( "apple" ,  "banana" ,  "cherry" ) print (thistuple) Tuple Items Tuple items are ordered, unchangeable, and allow duplicate values. Tuple items are indexed, the first item has index  [0] , the second item has index  [1]  etc. Ordered When we say that tuples are ordered, it means that the items have a defined order, and that order will not change. Unchangeable Tuples are unchangeable, meaning that we cannot change, add or remove items after the tuple has been created. Allow Duplicates Since tuples...

Python Math Module

  Python  Math Python has a set of built-in math functions, including an extensive math module, that allows you to perform mathematical tasks on numbers. Built-in Math Functions The  min()  and  max()  functions can be used to find the lowest or highest value in an iterable: Example x =  min ( 5 ,  10 ,  25 ) y =  max ( 5 ,  10 ,  25 ) print (x) print (y) The  abs()  function returns the absolute (positive) value of the specified number: Example x =  abs (- 7.25 ) print (x) The  pow( x ,  y )  function returns the value of x to the power of y (x y ). Example Return the value of 4 to the power of 3 (same as 4 * 4 * 4): x =  pow ( 4 ,  3 ) print (x) The Math Module Python has also a built-in module called  math , which extends the list of mathematical functions. To use it, you must import the  math  module: import  math When you have imported the  math  module,...

Python Loops

  While Loops Python Loops Python has two primitive loop commands: while  loops for  loops The while Loop With the  while  loop we can execute a set of statements as long as a condition is true. Example Print i as long as i is less than 6: i =  1 while  i <  6 :    print (i)   i +=  1 Note:  remember to increment i, or else the loop will continue forever. The  while  loop requires relevant variables to be ready, in this example we need to define an indexing variable,  i , which we set to 1. The break Statement With the  break  statement we can stop the loop even if the while condition is true: Example Exit the loop when i is 3: i =  1 while  i <  6 :    print (i)    if  i ==  3 :      break   i +=  1 The continue Statement With the  continue  statement we can stop the current iteration, and continue...