Boolean and Sets
Boolean and Sets In this tutorial we shall discuss about Boolean and Sets. Topics we have discussed in previous tutorials: Dictionaries Functions of dictionaries Tuples Functions of tuples Sets Few important functions of sets Boolean: Boolean are the expression such as True, False. These are used to test the data whether it is correct or wrong. E.g: If we type 1 == 1 as code, we know this value is correct and run the code we get True. E.g2 : If we type 1 == 5 as code, we know this value is correct and run the code we get False . This is the basic applications of Booleans. Now lets continue with some complicated data types in python. and: If we use this keyword between two conditions and two of the conditions are true then the value will be true or else for any other case it will be false. We also can use this between multiple conditions. Condition 1 Condition 2 Output True True True True False False False True False False False False or: If we use this keyword between two conditions and two of the conditions are true then value will be true or else for any other case it will be fasle. We also can use this between multiple conditions. Condition 1 Condition 2 Output True True True True False True False True True False False False These are two important Booleans we will be using very regularly in data manipulation techniques. Application of Boolean: To check whether an item belongs to the list or not. To check we have to write: element in the list. Decision Making in Python: Checking a condition and making the correct decision ( here correct means given by programmer ) is known as decision making. if statement: This is a decision-making statement, where a condition is given to it and asked for a decision. Syntax: else statement: This statement is used for only other than condition after if statement. elif statement : This statement is used for multiple conditions other than if condition . If any query in this tutorial let us know in the comment section. Topics we will cover in the next tutorial: Iterations For loops While loops Range List comprehension For more information visit the section of Data Science.