4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

Basics of Python's object and data structures

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.
https://images.hive.blog/DQmY48oLwYkqJLkLPLRN5r6Eoq7ZktUMdPHjySf6vH7XiYS/image.png
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.
https://images.hive.blog/DQmY48oLwYkqJLkLPLRN5r6Eoq7ZktUMdPHjySf6vH7XiYS/image.png
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.
https://images.hive.blog/DQmY48oLwYkqJLkLPLRN5r6Eoq7ZktUMdPHjySf6vH7XiYS/image.png
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.
https://images.hive.blog/DQmY48oLwYkqJLkLPLRN5r6Eoq7ZktUMdPHjySf6vH7XiYS/image.png
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.
https://images.hive.blog/DQmY48oLwYkqJLkLPLRN5r6Eoq7ZktUMdPHjySf6vH7XiYS/image.png
DICTIONARIES (dict)

Contrary to lists, dictionaries are unordered key-value pairs that use braces and are not well organized. "Goat": "name," "book": "store,"
https://images.hive.blog/DQmY48oLwYkqJLkLPLRN5r6Eoq7ZktUMdPHjySf6vH7XiYS/image.png
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 ().
https://images.hive.blog/DQmY48oLwYkqJLkLPLRN5r6Eoq7ZktUMdPHjySf6vH7XiYS/image.png
SETS (set)

Sets simple refer to an unordered group of distinct items that are separated by commas and enclosed in braces ().
https://images.hive.blog/DQmY48oLwYkqJLkLPLRN5r6Eoq7ZktUMdPHjySf6vH7XiYS/image.png
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:
    /?|()!@#$ %&*+- >
  • 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

289 upvotes 1 downvotes $8.52

Replies (7)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: