• Profile
  • Resume
  • Portfolio
  • Blog
Avatar

Nelson Silva

A human. Being. Coffee lover.

Blog

I Write My Thoughts Here

Variables in Python

September 16, 2021 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

Don’t forget to watch the video and you can always read this post in Portuguese.

Happy coding!

Previous Next

Categories

  • Announcements
  • Python
  • C#
  • Java
  • Go

Latest Posts

  • for Loop in Go
    May 5, 2022
  • Switch in Go
    May 4, 2022
  • Comparison Operators in Go
    May 3, 2022
+351913416022
contact@nelsonsilvadev.com
Porto, Portugal
Nelson Silva © 2022 All Rights Reserved