2 - Learn Python, Variables

in programming •  5 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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi! Did you know that steemit.com is now censoring users and posts based on their opinions?
All the posts of these users are gone!
https://github.com/steemit/condenser/commit/3394af78127bdd8d037c2d49983b7b9491397296

Here's a list of some banned users:
'roelandp', 'blocktrades', 'anyx', 'ausbitbank', 'gtg', 'themarkymark', 'lukestokes.mhth', 'netuoso', 'innerhive'
See anyone you recognize? There could be more, they also have a remote IP ban list.

Will you be censored next?