Python is considered the official programming language for non-programmers. It gives you increased flexibility and expansive access to your data. For those using IDEA 10.3 or higher, you can leverage the power of Python to build your own advanced analytics or use existing Python scripts to identify outliers within both numeric and character fields.
Let’s get started with a few tips to ease you into this new user-friendly programming language:
Python uses the # to write comments. Comments do not interfere with your instructions; they are simply notes for you and anyone interacting with your code.
# This is an example of a comment. For example, I can use this to explain how a complex equation works.
Python is classified as a weakly typed language. Variables are not required to declare their datatypes nor do functions force parameters to be a certain type. It’s also a dynamic language, meaning variables do not need to be declared and all types are inferred at assignment.
Text data is very simple to work with in Python. It may be interacted with directly without the requirement of first saving the value to a variable. Text values may be declared with either quotes or apostrophes. This simplifies the inclusion of quotes and apostrophes inside of your data without needing to use an escape sequence.
# As shown here, digits did not declare a type. It immediately took a value.
digits = "1234567890"
# If you’d like to isolate only the even numbers, for example, you may do so with the # variable or data directly.
Python handles numbers for you in the background. It essentially supports two types of numbers: Integers and floating point values. However, you don’t need to worry about telling it what kind of numbers you have due to its type inference.
whole_number = 10
floating_point = 3.1415
Boolean values are logical outcomes of either true or false. They are used in all sorts of ways, but most commonly is control flow statements like the if statement. To declare one, true or false must be capitalized in Python.
passed_test = True
Lists are more or less what they sound like. They are collections of data organized into a linear list. True to Python’s weakly typed nature, lists can hold any combination of datatypes (contrary to compiled languages). They are useful for keeping related pieces of information together and be accessed with an index value. This is an example of their syntax:
bundle_of_data = ["text", 5, True, 2.1]
In Python, slicing is how elements are retrieved from lists using a precise pattern. Indexing only retrieves a single value. Slicing, as seen in the even digits example, returns another list of data depending on the pattern given to it. The pattern follows this form: [starting point : ending point : counting by].
Ready to learn more about Python? Refer to these past Tech Tips for a deeper dive: