Python for Beginners: Syntax, Data Types, and Variables.

Loop Sciences
3 min readJan 7, 2023
Photo by Clément Hélardot on Unsplash

When beginning your journey of learning Python, there are three key features that you need to become familiar with. First is the fundamental syntax of the language, and then the most commonly used data types and variables.

There are two main syntax features to be aware of when working in Python. They are indentation and commenting.

Python uses indentation to define a block of code that should be executed together. Other languages will often use curly braces or keywords to denote separate blocks of code.

x = 10
if x > 5:
print("x is greater than 5")
print("This is inside the if block")
print("This is outside the if block")

In the code shown above, the first two printstatements are part of the if block of code, and will only be executed if x is greater than 5. The third print statement is outside of the if block and will always be executed on its own, regardless of the outcome of the if block.

Indentation can have a significant impact on your code, so it’s very important to pay attention to where it’s used. It also serves as a great way to visually troubleshoot any issues you may be having with a sequence of code containing several blocks.

--

--

Loop Sciences

Sharing thoughts, ideas, and practical applications based on our experiences with bridging the sciences of data analytics, enterprise strategy, and behavior.