DEV Community

Cover image for Beginner-friendly Python Concepts
Shariq Ahmed
Shariq Ahmed

Posted on

Beginner-friendly Python Concepts

Whenever someone asks developers what a newbie in programming should learn, they say python. But is python worth all this praise? Yes. Python is really easy. Though, there are developers who think that Ruby is also easy to learn. But for me, python is the easiest. Let’s see the most basic concepts that a newbie in python must learn.

1. Properties

Python is a dynamically typed language. This means you don’t have to declare variables in python. Further, since python is case-sensitive. That’s why both var and VAR are declared different. Moreover, you will have to use # and multi-line strings to comment and mention triple quotes in python. Contrary to the other languages, in python values are assigned by = sign. But == is used for equality testing.

2. Data Types

In python, the total number of built-in by default data types are 7. They are actually in these categories: text, numeric, sequence, mapping , set, boolean, binary and none types. But what actually is a list and dictionary. Well, the list is somewhat similar to a one-dimensional array. Dictionaries in python are built using hash tables.

3. Strings

No matter if there’s a number or a set of alphabet, if anything is enclosed by quotation marks, then they are strings. In python, strings can have single or even double quotation marks. For instance, both are considered strings.

print(‘Hi, I’m Shariq.’)

print(“12345”)

4. Flow Control

In python, ‘while’, ‘for’ and ‘if’ are the commonly used flow statements. Let’s see when each of these flow statements are used.

While: It’s used when we want to perform an operation repeatedly as shown in this example.

If: This is used to verify a condition. If the condition is found to be true then it will run.

For: It’s an iterating function.

5. Functions

In python, functions are defined by the keyword ‘def’ and then the function’s name. Like,

def celsius_to_fahr(temp)

Now, if you have read till this time, then I’m glad! Consider dropping your opinions in the comment.

But still, why should you learn python?

It’s easy. Fine.

But there must be some reason to learn it, right? Well, yes.

Python is a really versatile language. You can use it for data mining, data science, AI and what not. Also, it’s one of the fastest growing languages as per coder’s virtual home — Stack Overflow. Apart from this, python has a really supportive community.

Top comments (0)