2 - Learn Python, Variables

in #programming4 years ago

To define a variable just use the operator (=):

number = 1
string= hello
list = [1,2,3]

As you can see, it is not necessary to define the type of variables before using them.

TYPE OF DATA

  • int -> Integer of arbitrary size
  • float -> Floating point number
  • bool -> For true or false values
  • complex -> Complex numbers with real and imaginary part
  • str -> Used to represent text
  • bytes -> Used to represent bytes
  • list -> A changeable sequence of objects
  • tuple -> An immutable sequence of objects
  • set/frozenset -> A set of unique objects
  • dict -> A structure that associates keys with values

One opportunity that Python offers is to make multiple assignments on the same line of code

a , b , c = 10, 20, 30
print a * b + c


Finally to add the comments just use # at the beginning of the line, or if it is necessary after the instructions


#hello python
hello # python

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.031
BTC 59128.17
ETH 2522.40
USDT 1.00
SBD 2.48