The Python World

print(tuple1)The Python World

When you hear python, maybe the first thing you can imagine is a snake, well python is one of the most popular programming language and is an interpreted, high-level and general-purpose programming language.

Python Features

Functions Defined:

The core of extensible programming is defining functions. Python allows mandatory and optional arguments, keyword arguments, and even arbitrary argument lists

Lists:

List are one of the compound data types that Python understands. Lists can be indexed, sliced and manipulated with other built-in functions.

Intuitive Interpretation

Calculations are simple with Python, and expression syntax is straightforward: the operators +, -, * and / work as expected; parentheses () can be used for grouping.

Python knows the usual control flow statements that other languages speak — if, for, while and range — with some of its own twists, of course.

Object Oriented Programming

Object-oriented programming (OOP) is a method of structuring a program by bundling related properties and behaviors into individual objects. An object contains data, like the raw or preprocessed materials at each step on an assembly line, and behavior, like the action each assembly line component performs.

Id()

The id() function returns a unique id for the specified object.

All objects in Python has its own unique id. The id is assigned to the object when it is created.

This value is the memory address of the object and will be different every time you run the program

The id is the object’s memory address, and will be different for each time you run the program. (except for some object that has a constant unique id, like integers from -5 to 256)

Type

Data type is an important concept. Variables can store data of differentes types, and different types can do different things.

By default, python has the following built-in data types:

source: https://www.w3schools.com/python/python_datatypes.asp

If you want to specify the data type, you can use the constructor functions:

Mutable and Immutables objects in Python

As you know, every python variable holds an instance of an object. There are two types of objects: Mutable and Immutable. Whenever an object is instantiated, it is assigned a unique object id. The type of the object is defined at the runtime and it can’t be change afterwards. However, it’s state can be changed if it is a mutable object.

Mutable Objects

There are of type list, dict, set. This custom classes are generally mutable.

Immutable Objects

The immutable are of built-in types like int, float, bool, string, unicode, tuple. An immutable object can’t be changed after it is created.

--

--

Beginner Programar, social comunicator. Love pop music, family and friends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arquimedes

Beginner Programar, social comunicator. Love pop music, family and friends.