CBSE

Input Output Statements in Python

Input Statements in Python: We can read the variables by using python input() function as:1) We can write any string/text to be displayed at the python prompt as an argument to the input function.2) If we don’t specify any string/text to be displayed at the python prompt , then nothing will be displayed. But we …

Input Output Statements in Python Read More »

Type Conversion in Python

Type Conversion: It means to convert the operands of one data type into another data type. Types of Conversions: Python supports two types of conversions:1) Implicit Type Promotion/ Internal Conversion 2) Explicit Type Casting/ External Conversion 1) Implicit Type Promotion/ Internal Conversion : It is the conversion done by the python compiler/interpreter without user’s intervention.1) …

Type Conversion in Python Read More »

Expressions in Python

Expressions: It is any valid combination of operators and operands (may be literals / variables). It is composed of one or more operations. Example 1) 5 + 4 is valid2) 5 + -4 is valid3) 5 + * 6 is invalid because in this case, compiler will be confused which operation whether + or * …

Expressions in Python Read More »

Flow of Control in Python

Statements Flow Control: It determines the order of execution of statements in a program. Types of Statements Flow Control: There are 3 types of flow control in python.1) Sequential Flow2) Conditional / Branching / Decision Making / Selection Statements3) Iteration/ Repetition/ Looping Statements 1) Sequential Flow: In it, statements are executed in sequence one after …

Flow of Control in Python Read More »

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 »

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