Code in Python
Machine Learning and Deep Learning Blogs

Category: Python Basics (page 1 of 2)

Learn about Classes and Objects in Python

The object oriented concepts in Python programming can be implemented using classes and objects. In this article, you will learn how to create class and object. Creating Classes – class ClassName: class_body The class_body consists of all the components to define the class members such as data attributes and functions. Below is the example for […]

Object Oriented Programming in Python

Python supports object-oriented programming. For those of you who already have a background in another programming language, the concept of object-oriented programming in Python is similar. For our programming beginners, this article will explain the concepts of object oriented programming. Earlier before the object-oriented programming was introduced, programming languages used to follow procedural programming paradigm. […]

How to work with while loop in Python

While is a type of looping statement where the number times of the statement will iterate is decided by the condition of the loop. If the condition is true then the loop will execute otherwise it will terminate and will execute statement after the loop. While is an entry controlled loop where the condition of […]

How to work with for loop in Python

For loop is a looping statement that is used when it is known beforehand how many times the loop has to run. Therefore it is already defined the number of times for loop will iterate. The for loop has an ability to iterate over any kind of sequential data types like list or string. The […]

Learn about Loops and Control Statements in Python

In general, in any programming language statements are executed sequentially. The first statement in our code is executed first, followed by the second statement, and so on. There may be a situation when you need to execute a block of code several numbers of times. Putting that block of code in loop helps to execute […]

All you need to know about Functions in Python

You may be faintly familiar with functions by constantly using the built-in functions that Python provides. For example print(), input(), etc. are some of the built-in functions in Python. A function consists a block of code with which we want to perform some kind action. Now instead of writing that particular code repeatedly when a […]

Conditional Statements ( if, elif and else ) in Python.

Ever thought how would I implement a certain block of code if it satisfies certain condition? If, else and elif are conditional statements in Python. The if statement gives a specific condition to the code. If the program satisfies that condition, then the program get executed otherwise it will jump to else statement. The syntax […]

How to work with Tuples in Python

A tuple is a sequence data type that is similar to list. Tuples are immutable lists. It contains a set of numbers or characters or a combination of both separated by commas and enclosed within parenthesis (()). Lists are enclosed in square brackets ([]) whereas tuple is within parenthesis (()). The one thing that separates […]

Learn about Dictionary in Python 3

We have stored values in variables and lists. In lists, the values were accessed using indices. Dictionary stores values using keys. Keys in dictionaries map directly to the values. It is like a hash table. It is enclosed in curly braces ({}) and every key and its value are separated by commas. A colon (:) […]

Learn about Python List and its Built-in Functions

A Python list is a sequence data type similar to array. It contains characters(numbers, letters, words) separated by commas and enclosed in square brackets ([]). A list can consist of all elements as numbers, characters or a combination of both. The arrangement of the elements in a list is not specified (it can be sorted […]

Older posts

© 2018 Code in Python