DEV Community

Cover image for A few Python Definitions

Posted on

A few Python Definitions

As you begin on your Python journey, some of the jargon can be overwhelming, especially if Python is your first foray into the programming world. Here you'll find a few terms and definitions you'll encounter as your Python career progresses.

Data type: You'll hear this term commonly; Used to refer to different different types of data (hard not to use the word to describe itself), some examples include str, int, list, tuple, set, dict, bool.

Variable: Used to store different data types. Variables are case sensitive, uses "snake_case" or "camelCase" when naming the variable (though this is debated, feel free to use what you're comfortable with and use it consistently). There are restrictions when naming a variable, such as variables cannot start with a number, use one of the reserved keywords, or contain spaces to name a few.

Object: A collection of data and methods.

Function: A block of code that can perform an action as many times as necessary. Able to interact with different variables and user input. Needs to be called.

Method: A Function that "belongs" to an object and is used to interact with said object in some way.

str: String, a piece of text. Written with quotations, single dash (' ') or double dash (" "). Rule of thumb with quotations - pick a style and be consistent with it.

int: Integer, a number data type. int will return whole numbers.

float: Floating point number, will return numbers as decimal.
Whole vs Decimal

list: Ordered sequence of objects. Written with brackets [ ]. Able to store different data types. List are mutable, meaning the objects can be modified/replaced, and their order to changed. Closest to an array as you can get with Python.

bool: Boolean, simplify meaning True or False. Important to remember that False == 0 and True == 1 (note the 0 and 1 are NOT strings).

These are only a fraction of terms you'll come across in your Python career. You'll notice there are some terms that I listed earlier but didn't give a definition, even in the list screenshot there are some terms used I didn't even mention (class, type(), print).

Take this time to practice your Google-Fu and hunt down the meaning of those terms and even expand on the terms above. Searching for issues/problems while coding comes with the territory, because nine times out of ten someone else had the same problem you're having.

Happy coding!

Discussion (0)