Conditional statement - The if keyword is used to check a condition. If statement - If the condition is true then the block of code inside the id statement is executed. Syntax of if statement -->. if condition : ____statement # INDENTATION - It is a white space character used at beginning of line. If-elif - It is a keyword that allows to check multiple conditions. It comes after an if & is used if the 'if' statement isn't executed or the condition is false. It can be of multiple times after if is made. Else - It is a keyword which is executed of all the conditions of the id and elif conditions are false. #* In this no conditions are required only statements are printed. Loop - These are used to execute a block of code repeatedly based on certain conditions. These are of two types - 1. For loop. 2. While loop. 1-> wHILE- loop executes a b...
Posts
Showing posts from February, 2025
Comments and operators in python.
- Get link
- X
- Other Apps
Comments - It is type of logical notes which are not a part of of a code. There are two types of comments - Single line comment - It is started with a symbol (#). Example - # This is a comment. Multi- line comments - It is started by s triple quotes ("'......"'). 2. Uses of comments - It increases the readability of a code. Re- using existing code. Understanding code after long term use. 3. Operators- It is a particular symbol which is used to perform some operations with the help of operands. Operands - A kind of data types used for calculations. It always exists with python operators. 🔥 Operators may be unary, Binary, Ternary. Operators with one operands is unary operator. Example- ++a Operators with two operand is called binary operators. Example- a+b Operators with three operands is called ternary operators. Example a<b and a>b. 4. Classification of operators:- a. Arithmetic ope...