Basics of Python's object and data structures

avatar

Hello ๐Ÿ‘‹๐Ÿ‘‹๐Ÿ‘‹ i hope you are doing well. It was a wonderful day for me because I got to meet my nephew for the first time. I have seen a lot of his pictures, but seeing him in person was a special feeling to me.
โ€œRunning Python Codeโ€ source and โ€œA Python Programming Language Introduction and Installation Guideโ€source were topics I covered in may earlier blogs. As a result, I made the decision to pick up where I left off. The link is provided above in case you are interested in taking a look.
90E4EE7A-5B2F-4790-BFF7-37C7C9E6492A.jpegsource
The fundamental building blocks of larger pieces of code are data types. I will go through some fundamental Python data types down below.

INTEGERS (int)

Whole numbers are considered integers. Examples include 5, 10, 8, and so on. Python programming classifies any whole number you can imagine as an integer.

FLOATING POINT (float)

In Python programming, a floating point is any number with a decimal point, such as 8.2, 1.5, or 3.0.
3.0, which is also known as 3 becomes a floating point whenever the point is signified.

STRINGS (str)

Strings are lists of objects that are double- or single-quoted, such as "man," "book," "Shamzy," "son," "1," etc. The single or double quotes are what distinguish an integer from a string.

LISTS ( list)

A list is an ordered grouping of items that uses commas and square brackets to group related items together. An example of this is [1, "book", 1.1], where we can see that the values in the square brackets correspond to an integer, a string, and a floating point, respectively.

DICTIONARIES (dict)

Contrary to lists, dictionaries are unordered key-value pairs that use braces and are not well organized. "Goat": "name," "book": "store,"

TUPLES (tup)

The term "tuple" refers to an ordered, immutable list of Python objects.
Due to their immutability, tuples cannot be changed after they have been generated. Parentheses are used to define tuples ().

SETS (set)

Sets simple refer to an unordered group of distinct items that are separated by commas and enclosed in braces ().

BOOLEANS (bool)

The logical value of a boolean is a True or False indication. True is denoted with a capital "T," while false is denoted by a capital "F."
11AD7944-F588-4706-BE0C-54CD5DA26C40.jpegsource
CONDITIONS FOR SELECTING A VARIABLE NAME
Follow these guidelines to avoid mistakes when programming in Python:

  • Names cannot begin with a number, for example. 1Alex. Instead of using a space in a name, use an underscore. For instance:
    last letter (incorrect โŒโŒโŒ)
    last_letter (correctโœ…โœ…โœ… )
  • Avoid using any of the following symbols:
    /?|()[email protected]#$ %&*+- >
  • As much as possible , always use small letters in writing names
  • Avoid using terms like "int," "float," "str," "list," "dict," "tup," "set," "bool," etc. that have unique meanings in Python.

Thank you for reading, I will greatly appreciate your support and any comments, additions, and corrections.

DISCORD: samzy#5007

Posted with STEMGeeks



0
0
0.000
7 comments
avatar

Nice begining to learn variables!!
!1UP

You can earn passive income by delegation of tribe tokens to "The Cartel".

dlmmqb-TheCartel-banner
Click this banner to join "The Cartel" discord server to know more.

0
0
0.000
avatar

This will be so helpful for beginners in python programming.

0
0
0.000