Python: Variables and data types 2/12

in #programming6 years ago

Source.

What are the variables?

Source.

It is a space in the memory of the computer that serves to store data, this data can vary its value during the execution of the program.

Type of data?


Source.

The most basic types of storage are the integer numbers better known in programming as Int, which are those that do not have a decimal point:

1, 2, 3, 4, 5, 10, "Int integers"

But there are also real numbers of real type, which are those that have a decimal point are also known as float and double.

3.14, 99.8 "Real-type numbers"

String types are called text strings or characters.

Example: Hello world.


Boolean text "Bool" They can only have two values, these are "True or false", true or false.

There are two more complexes but for now they will be these.

The syntax for declaring a variable in python simply consists of three parts.

It must be formed by the name of the variable:

Syntax:

>>> Name_of_the_variable next to = or better known as the sign of the assignment.


What we do when assigning variables is to assign values.

Last is the value of the variable.

Example:

>>> House = House_Number1

>>> Print

>>> House_ Number1



Dynamic typing:

It is not necessary to declare the type of data that a variable will store, but its type will be determined at execution time depending on the type of the type of value assigned to it.

Variable in py = Num_entero = 10


Compared to C ++, the first thing that is placed is the type of data that we are going to declare.

Example:

Int - Num_entero = 10

Unlike the type of integer in py, it is not necessary because it automatically determines depending on the value that we are assigning, in this case.

The number 10 is integer and would be a variable of type Int.

Sort:  
Loading...

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 62102.06
ETH 2415.08
USDT 1.00
SBD 2.49