Variables in Python
In this post, you will learn how to work with integer, decimal (float), string and boolean variables so that you can use that same knowledge and thus evolve.
- a variable is an object (a position located in the memory) that represents a value or an expression;
- in some of the existing programming languages it is necessary to define the variable type but not in Python;
- in Python the variable type is dynamic and not a fixed data type (it is automatically detected depending on its content);
- variable types: integer, decimal (float), string, boolean, lists, dictionaries and a few more;
- it should be noted that we are going to talk about lists and dictionaries in future posts.
integer = 10 decimal = 10.5 string = 'I\'m a string.' boolean = True print('integer:', integer) # integer: 10 print('decimal:', decimal) # decimal: 10.5 print('string:', string) # string: I'm a string. print('boolean:', boolean) # boolean: True