Python

Statements in Python

Statements: It is a command or instruction that the python interpreter can understand and execute. If we type a statement on the command line, Python executes it.We may also write a sequence/group of statements in a script/program. Types of Statement: There are 3 types of statements:1) Empty Statement2) Simple Statements3) Compound Statements / Block Empty Statement: …

Statements in Python Read More »

Indentation in Python

Indentation It refers to the (spaces and tabs) that are used at the beginning of a statement. It is used to create groups/blocks/compound statements in python.The statements with the same indentation belong to the same group/block. Block / Compound Statement It is a group of statements (piece of python program text) executed as a unit. The …

Indentation in Python Read More »

Structure of a program in Python

The structure of a program is defined by its control flow. It is built from blocks of code, where each block has a single entry and a single exit point in the control flow.The typical structure of a python program include 3 parts Import statements// import statements are used to include library files to the …

Structure of a program in Python Read More »

Operators in Python

Operator: It is a symbol that performs some action. Python supports following types of operators: Arithmetic operators : Python supports 7 arithmetic operators1) + : To perform addition2) – : To perform subtraction3) * : To perform multiplication4) / : To perform division5) // : To perform integer division ie returns greatest integer less than …

Operators in Python Read More »

Data Types in Python

Data Type: It specifies the type of data and associated operations of handling it. Different set of operations are applicable on different types of data. Example: We can add, subtract, multiply, divide two numbers. But we cant subtract, multiply, divide two strings ie textual data. Data Types in Python: Following data types are supported in …

Data Types in Python Read More »

Modules in Python

Module: It is a file containing python definitions and statements. It may contain functions, classes, and variables. Grouping related code into a module makes the code easier to understand and use. How to import a module: We can import a module in python asimport modulename >>> import math >>> import random >>> import statistics We …

Modules in Python Read More »

Types of Errors in Python

Error/Bug: Error is a mistake/bug in the program which makes the behavior of the program abnormal. It prevents a program from compiling and running correctly. So, the errors must be removed from the program for the successful execution of the program. Programming errors are also known as the bugs. These errors are detected either during …

Types of Errors in Python Read More »

error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.