Day 13: Getting started with Python

Day 13: Getting started with Python

1) What is Python?

  • Python is Open source, general purpose, high-level, and object-oriented programming language.

  • Guido van Rossum developed Python

  • Python consists of vast libraries and various frameworks like Django, Tensorflow, Flask, Pandas, Keras, etc.

How to Install Python?

Now let's see how to install Python before that let's update our Ubuntu server as

This will update our server with the latest packages. Now let's install python as

Also, install pip for python sudo apt install python3-pip. To check the version of Python use this command

2. Read about different Data Types in Python.

1. Numeric Data Type

  • Numeric data types: int, float, long, complex

  • Python numeric data type is used to hold numeric values like;

    1. int - holds signed integers of non-limited length. ex=10

    2. long- holds long integers(exists in Python 2.x, deprecated in Python 3.x).

    3. float- holds floating precision numbers and it’s accurate up to 15 decimal places. ex=15.25

    4. complex- holds complex numbers. ex=100+3j

2. Python String Data Type: Str

The string is a sequence of characters. Python supports Unicode characters. Generally, strings are represented by either single or double-quotes.

For example,

a = "Hello GoodMorning How re you"

b= 'Hello GoodMorning'

print(a) print(b)

3. Python List Data Type:

Lists are just like arrays, declared in other languages which is an ordered collection of data. It is very flexible as the items in a list do not need to be of the same type. Lists are mutable.

Lists in Python can be created by just placing the sequence inside the square brackets[].

For example,

1)list of having only integers

a= [1,2,3,4,5,6] print(a)

2)list of having only strings

b=["hello","Akshay","Phadke"] print(b)

4. Python Tuple:

The tuple is another data type which is a sequence of data similar to a list. But it is immutable. That means data in a tuple is write-protected. Data in a tuple is written using parenthesis ( ) and commas.

For example,

#tuple having multiple type of data.

b=("hello", 1,2,3,"go")

print(b) #prints the whole tuple

5. Python Dictionary:

Python Dictionary is an unordered sequence of data of key-value pair form. It is similar to the hash table type. Dictionaries are written within curly braces in the form key:value. It is very useful to retrieve data in an optimized way among a large amount of data.

For example,

a = {1:"first name",2:"last name", "age":33}

Did you find this article valuable?

Support Akshay Phadke by becoming a sponsor. Any amount is appreciated!