title
#19 Python Tutorial for Beginners | If Elif Else Statement in Python

description
Telusko Courses: Java Simplified LiveCourse : https://bit.ly/java-pro-telusko Advance Java with Spring Boot Live Course : https://bit.ly/adv-java-telusko Complete java developer Course : https://bit.ly/complete-java Coupon Code: TELUSKO10 (10% off) Udemy Courses: Java:- https://bit.ly/JavaUdemyTelusko Spring:- https://bit.ly/SpringUdemyTelusko Java For Programmers:- https://bit.ly/javaProgrammers For More Queries WhatsApp or Call on : +919008963671 website : https://courses.telusko.com/ Instagram : https://www.instagram.com/navinreddyofficial/ Linkedin : https://in.linkedin.com/in/navinreddy20 TELUSKO Android App : https://bit.ly/TeluskoApp In this lecture we will learn: - Different units of a CPU - Conditional statements in Python - If and Else statements - Execution of conditional blocks - What is Indentation in Python? - Nested if and else statements - if, elif and else statements #1 - CPU has three parts: CU (Control Unit), ALU ( Arithmetic Logic Unit) and MU ( Memory unit). - MU is used to store variables and data. - ALU has two parts: 1. AU - Arithmetic Unit ( it performs mathematical calculations) 2. LU - Logical Unit ( it makes a computer think something) #2 If statement:- - In programming, we have to apply conditions as per the logic of the code. In python, conditions can be applied through the if keyword. - Use of the if keyword specifies the flow of execution of the code. - Based on the condition of the problem statement, if keyword helps to decide which set of statements should be executed. Syntax:- if (condition): statement; - The statements of the if block will be executed only when the condition of the if statement is true. If the condition is false then it will skip the execution of statements present inside the if block. - If consists of a block where you can write multiple statements. In python, it is also known as Suite. #2 Indentation:- - In Python, we have to follow certain indentations that specify the conditions that are present inside a certain block. - Indentation simply means a certain number of spaces at the beginning of a code line. - Indentation increases the readability of the code. #3 Else block:- - We can also use multiple if blocks in a code. - Multiple uses of the if block decrease the efficiency of a code as the condition will be checked again and again in each if block. - To make the code efficient, we use the else block. - If the condition of the if block is true then the else block will be skipped. And if the condition of the if block is false then the else block will be checked and executed. #4 Nested if and else statements:- - Nested if and else statements are also allowed in Python. - if statement can also be checked inside other if statement. This conditional statement is called a nested if statement. - In nested, the inner if condition will be checked only if the outer if condition is true and that helps to see multiple conditions to be satisfied. - Round brackets for putting a condition in the if statement is optional. #5 if, elif and else statements:- - elif stands for if-else. - The if-elif statement is a shortcut of if..else chain. - If the if condition s false, then the condition inside the elif will be checked and executed. - While using if-elif statement at the end else block is added that will be executed when none of the above if-elif statements is true. Github :- https://github.com/navinreddy20/Python- Python for Beginners :- http://bit.ly/3JOLQhl Editing Monitors : https://amzn.to/2RfKWgL https://amzn.to/2Q665JW https://amzn.to/2OUP21a. Java:- https://bit.ly/JavaUdemyTelusko Spring:- https://bit.ly/SpringUdemyTelusko More Learning : Java :- https://bit.ly/3x6rr0N Python :- https://bit.ly/3GRc7JX Django :- https://bit.ly/3MmoJK6 JavaScript :- https://bit.ly/3tiAlHo Node JS :- https://bit.ly/3GT4liq Rest Api :-https://bit.ly/3MjhZwt Servlet :- https://bit.ly/3Q7eA7k Spring Framework :- https://bit.ly/3xi7buh Design Patterns in Java :- https://bit.ly/3MocXiq Docker :- https://bit.ly/3xjWzLA Blockchain Tutorial :- https://bit.ly/3NSbOkc Corda Tutorial:- https://bit.ly/3thbUKa Hyperledger Fabric :- https://bit.ly/38RZCRB NoSQL Tutorial :- https://bit.ly/3aJpRuc Mysql Tutorial :- https://bit.ly/3thpr4L Data Structures using Java :- https://bit.ly/3MuJa7S Git Tutorial :- https://bit.ly/3NXyCPu Donation: PayPal Id : navinreddy20 https://www.telusko.com

detail
{'title': '#19 Python Tutorial for Beginners | If Elif Else Statement in Python', 'heatmap': [{'end': 206.95, 'start': 168.609, 'weight': 0.851}, {'end': 390.85, 'start': 350.027, 'weight': 0.712}, {'end': 404.579, 'start': 393.832, 'weight': 0.723}, {'end': 733.076, 'start': 693.248, 'weight': 0.804}], 'summary': "The tutorial covers python's cpu logical unit, if statements, and indentations, emphasizing the execution of code. it explains identifying even or odd numbers, optimizing code performance, and using if, else, and elif statements in python with clear examples and code explanations.", 'chapters': [{'end': 338.858, 'segs': [{'end': 137.1, 'src': 'embed', 'start': 110.946, 'weight': 2, 'content': [{'end': 115.911, 'text': 'So using if you can actually specify the flow of your execution, either we have to go in this way or that way.', 'start': 110.946, 'duration': 4.965}, {'end': 118.493, 'text': 'I would also recommend you to learn about flowcharts.', 'start': 116.331, 'duration': 2.162}, {'end': 121.657, 'text': "Of course, as a programmer, it's a good to know concept.", 'start': 119.094, 'duration': 2.563}, {'end': 124.6, 'text': 'If you know how flowchart works, it will be helpful for your programming career.', 'start': 121.717, 'duration': 2.883}, {'end': 128.118, 'text': "let's understand how this, how this if, works.", 'start': 125.257, 'duration': 2.861}, {'end': 130.178, 'text': 'so, if you can see, we have three statements here, right.', 'start': 128.118, 'duration': 2.06}, {'end': 132.098, 'text': 'so after this three statement, we have two flow.', 'start': 130.178, 'duration': 1.92}, {'end': 137.1, 'text': 'now either we want to execute this set of statements or i want to execute the other set of statements.', 'start': 132.098, 'duration': 5.002}], 'summary': 'Understanding flowcharts can guide programming decisions and improve career prospects.', 'duration': 26.154, 'max_score': 110.946, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw110946.jpg'}, {'end': 206.95, 'src': 'heatmap', 'start': 168.609, 'weight': 0.851, 'content': [{'end': 169.129, 'text': 'I want to print.', 'start': 168.609, 'duration': 0.52}, {'end': 170.13, 'text': "I'm right.", 'start': 169.129, 'duration': 1.001}, {'end': 171.49, 'text': 'so if it is true, it will print.', 'start': 170.13, 'duration': 1.36}, {'end': 172.691, 'text': "I'm right, that's it.", 'start': 171.49, 'duration': 1.201}, {'end': 176.112, 'text': "let's run this And you can see we got the answer, which is I'm right.", 'start': 172.691, 'duration': 3.421}, {'end': 180.815, 'text': 'If this is false, then it will not execute the particular block.', 'start': 176.773, 'duration': 4.042}, {'end': 181.676, 'text': 'So this is false.', 'start': 180.975, 'duration': 0.701}, {'end': 182.977, 'text': 'Let me run this code.', 'start': 182.096, 'duration': 0.881}, {'end': 184.698, 'text': "And you can see it's not executing the block.", 'start': 183.197, 'duration': 1.501}, {'end': 186.239, 'text': "So that's how your if works.", 'start': 185.018, 'duration': 1.221}, {'end': 188.56, 'text': 'If it is true, then only it will execute the block.', 'start': 186.479, 'duration': 2.081}, {'end': 189.361, 'text': 'But hold on.', 'start': 188.84, 'duration': 0.521}, {'end': 197.626, 'text': 'What is that block? And what is this colon? And what is this statement? So thing is, whenever we use if, if is basically a block.', 'start': 189.941, 'duration': 7.685}, {'end': 202.449, 'text': 'And in Python, we call them as suit, where you can write multiple statements.', 'start': 197.766, 'duration': 4.683}, {'end': 206.95, 'text': 'But then how will you mention that this statement belongs to if?', 'start': 203.089, 'duration': 3.861}], 'summary': "Demonstration of conditional statement 'if' in python with example code execution.", 'duration': 38.341, 'max_score': 168.609, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw168609.jpg'}, {'end': 214.332, 'src': 'embed', 'start': 183.197, 'weight': 0, 'content': [{'end': 184.698, 'text': "And you can see it's not executing the block.", 'start': 183.197, 'duration': 1.501}, {'end': 186.239, 'text': "So that's how your if works.", 'start': 185.018, 'duration': 1.221}, {'end': 188.56, 'text': 'If it is true, then only it will execute the block.', 'start': 186.479, 'duration': 2.081}, {'end': 189.361, 'text': 'But hold on.', 'start': 188.84, 'duration': 0.521}, {'end': 197.626, 'text': 'What is that block? And what is this colon? And what is this statement? So thing is, whenever we use if, if is basically a block.', 'start': 189.941, 'duration': 7.685}, {'end': 202.449, 'text': 'And in Python, we call them as suit, where you can write multiple statements.', 'start': 197.766, 'duration': 4.683}, {'end': 206.95, 'text': 'But then how will you mention that this statement belongs to if?', 'start': 203.089, 'duration': 3.861}, {'end': 214.332, 'text': 'because, see, if I write one more statement here, I mean just below that if I say print and if I say by now, what do you think we are saying false?', 'start': 206.95, 'duration': 7.382}], 'summary': 'Explanation of how if statement works in python with a focus on block execution and conditions.', 'duration': 31.135, 'max_score': 183.197, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw183197.jpg'}, {'end': 273.333, 'src': 'embed', 'start': 244.668, 'weight': 1, 'content': [{'end': 250.154, 'text': 'So if you want to specify all the statements, belongs to if we do use some certain indentation.', 'start': 244.668, 'duration': 5.486}, {'end': 252.997, 'text': 'And what is indentation? Some specific spaces.', 'start': 250.394, 'duration': 2.603}, {'end': 255.76, 'text': 'It can be one space, two space, three space, ten space.', 'start': 253.137, 'duration': 2.623}, {'end': 257.281, 'text': 'It can be hundred spaces.', 'start': 256.141, 'duration': 1.14}, {'end': 259.603, 'text': 'You have to use certain number of spaces.', 'start': 257.322, 'duration': 2.281}, {'end': 265.088, 'text': 'so if i use four space here for this one as well, i need to use four space.', 'start': 260.385, 'duration': 4.703}, {'end': 268.45, 'text': 'even if i use three space, you can see it will give you error.', 'start': 265.088, 'duration': 3.362}, {'end': 273.333, 'text': 'okay. so it says on unintended does not match any other international level.', 'start': 268.45, 'duration': 4.883}], 'summary': 'Specifying indentation with 1, 2, 3, 4, 10, or 100 spaces is essential for the statements to match certain international levels.', 'duration': 28.665, 'max_score': 244.668, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw244668.jpg'}], 'start': 4.414, 'title': 'Python cpu and logical unit', 'summary': "Covers the logical unit in python's cpu, explaining if statements, conditions, and indentations for code execution, with a suggestion to explore flowcharts in programming.", 'chapters': [{'end': 338.858, 'start': 4.414, 'title': 'Python cpu and logical unit', 'summary': "Discusses the logical unit in python's cpu, covering the concept of if statements, conditions, and indentations used for executing code blocks, with a recommendation to learn about flowcharts in programming.", 'duration': 334.444, 'highlights': ["The logical unit in Python's CPU, involving the usage of if statements to specify the flow of execution based on conditions, is explained, with examples illustrating the execution of code blocks based on true or false conditions. Usage of if statements to control the flow of execution based on conditions, demonstration of code block execution based on true or false conditions.", 'The importance of understanding flowcharts as a programmer, for aiding in the visualization and planning of program logic, is emphasized, with the suggestion to learn the concept for enhancing programming skills. Emphasis on the significance of understanding flowcharts for visualizing and planning program logic, recommendation to learn about flowcharts for improving programming skills.', 'The concept of indentation in Python, used to specify code blocks related to if statements, is detailed, with the demonstration of how indentation impacts the execution of code and the necessity of maintaining consistent indentation. Explanation of the concept of indentation in Python for organizing code blocks, demonstration of the impact of indentation on code execution, and the significance of maintaining consistent indentation.']}], 'duration': 334.444, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw4414.jpg', 'highlights': ["The logical unit in Python's CPU, involving the usage of if statements to specify the flow of execution based on conditions, is explained, with examples illustrating the execution of code blocks based on true or false conditions.", 'The concept of indentation in Python, used to specify code blocks related to if statements, is detailed, with the demonstration of how indentation impacts the execution of code and the necessity of maintaining consistent indentation.', 'The importance of understanding flowcharts as a programmer, for aiding in the visualization and planning of program logic, is emphasized, with the suggestion to learn the concept for enhancing programming skills.']}, {'end': 586.935, 'segs': [{'end': 393.292, 'src': 'heatmap', 'start': 338.858, 'weight': 0, 'content': [{'end': 342.502, 'text': "let's say i want to check if the given number is even or odd.", 'start': 338.858, 'duration': 3.644}, {'end': 345.864, 'text': 'Maybe the input is coming from the user or I will take my own input.', 'start': 342.842, 'duration': 3.022}, {'end': 348.306, 'text': 'Let me take my own input and you can try it with the user input.', 'start': 346.004, 'duration': 2.302}, {'end': 350.027, 'text': 'I will take the number as 3.', 'start': 348.586, 'duration': 1.441}, {'end': 356.911, 'text': 'Okay, If the number so, when you say even number, odd number, what it means if the number gets divided by 2, if the remainder is 0,', 'start': 350.027, 'duration': 6.884}, {'end': 358.112, 'text': "then it's an even number, right?", 'start': 356.911, 'duration': 1.201}, {'end': 362.815, 'text': 'If the remainder is not 0,, which is 1, in this case it will be odd number.', 'start': 358.732, 'duration': 4.083}, {'end': 369.699, 'text': 'How do I verify that? So what I will do is I will use a variable r and I will save the remainder which is either 0 or 1.', 'start': 363.095, 'duration': 6.604}, {'end': 378.303, 'text': 'So I will say x mod, remember the symbol which we have used, mod 2, right? So in r it is either 0 or it is 1.', 'start': 369.699, 'duration': 8.604}, {'end': 390.85, 'text': 'right. so instead of using false, i want to check if my r is equal to 0, because if my r is equal to equal to 0, then it will print even right.', 'start': 378.303, 'duration': 12.547}, {'end': 393.292, 'text': "so if my r is equal to 0, that means that's a even number.", 'start': 390.85, 'duration': 2.442}], 'summary': 'Demonstration of checking if a number is even or odd using remainder division and comparison.', 'duration': 54.434, 'max_score': 338.858, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw338858.jpg'}, {'end': 423.252, 'src': 'heatmap', 'start': 393.832, 'weight': 0.723, 'content': [{'end': 394.933, 'text': 'okay, that works.', 'start': 393.832, 'duration': 1.101}, {'end': 395.433, 'text': "let's try.", 'start': 394.933, 'duration': 0.5}, {'end': 396.854, 'text': 'i will run this code.', 'start': 395.433, 'duration': 1.421}, {'end': 398.095, 'text': 'oh okay, so that we got by.', 'start': 396.854, 'duration': 1.241}, {'end': 398.675, 'text': 'you know why?', 'start': 398.095, 'duration': 0.58}, {'end': 402.878, 'text': "why we got by is because x is three and it's not number.", 'start': 398.675, 'duration': 4.203}, {'end': 404.579, 'text': "let's try with eight.", 'start': 402.878, 'duration': 1.701}, {'end': 406.601, 'text': "eight is an even number, right, let's try this.", 'start': 404.579, 'duration': 2.022}, {'end': 408.522, 'text': 'we got the answer, which is even and by.', 'start': 406.601, 'duration': 1.921}, {'end': 413.425, 'text': "so yes, we got even number because that's an even number and we got by because it should be printed anyway.", 'start': 408.522, 'duration': 4.903}, {'end': 414.566, 'text': 'this is how you work with.', 'start': 413.425, 'duration': 1.141}, {'end': 416.968, 'text': 'if so, if this is true, okay, this is important.', 'start': 414.566, 'duration': 2.402}, {'end': 418.228, 'text': 'this is true, then it will print.', 'start': 416.968, 'duration': 1.26}, {'end': 421.37, 'text': 'even if this is false, it will not execute the block.', 'start': 418.228, 'duration': 3.142}, {'end': 423.252, 'text': 'it will not execute the statement inside that.', 'start': 421.37, 'duration': 1.882}], 'summary': 'Code successfully executes for even and odd numbers, with examples of x=3 and x=8.', 'duration': 29.42, 'max_score': 393.832, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw393832.jpg'}, {'end': 510.151, 'src': 'embed', 'start': 484.565, 'weight': 3, 'content': [{'end': 489.652, 'text': "But don't you think if the number is even okay, everything is working as of now, but there's a twist here.", 'start': 484.565, 'duration': 5.087}, {'end': 495.579, 'text': "See, as a programmer, we also want to improve the performance, right? It's not just about writing code.", 'start': 490.413, 'duration': 5.166}, {'end': 497.221, 'text': "It's not just about getting the output.", 'start': 495.599, 'duration': 1.622}, {'end': 499.184, 'text': "It's about writing the efficient code.", 'start': 497.261, 'duration': 1.923}, {'end': 500.426, 'text': 'And this is not efficient.', 'start': 499.544, 'duration': 0.882}, {'end': 500.846, 'text': 'You know why?', 'start': 500.446, 'duration': 0.4}, {'end': 505.669, 'text': 'because when you say your number is eight and eight is even, we know that.', 'start': 501.647, 'duration': 4.022}, {'end': 506.61, 'text': 'so it will check.', 'start': 505.669, 'duration': 0.941}, {'end': 509.111, 'text': 'if r is zero, yes, it will print even.', 'start': 506.61, 'duration': 2.501}, {'end': 510.151, 'text': "that's right.", 'start': 509.111, 'duration': 1.04}], 'summary': 'Efficiency is important in programming, as even numbers are checked for efficiency in this case.', 'duration': 25.586, 'max_score': 484.565, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw484565.jpg'}, {'end': 590.216, 'src': 'embed', 'start': 563.599, 'weight': 2, 'content': [{'end': 567.643, 'text': 'If this is getting executed, it will not be when checking the else condition.', 'start': 563.599, 'duration': 4.044}, {'end': 568.603, 'text': 'Let me just prove my point.', 'start': 567.663, 'duration': 0.94}, {'end': 570.245, 'text': 'I will put a breakpoint here.', 'start': 569.024, 'duration': 1.221}, {'end': 574.248, 'text': 'I will say debug, right click, debug, and F8.', 'start': 570.725, 'duration': 3.523}, {'end': 581.712, 'text': "For the flow you can see r is 0, yes, it's going to even and now it has skipped the else block.", 'start': 575.649, 'duration': 6.063}, {'end': 583.553, 'text': 'So this is how you improve the performance.', 'start': 581.872, 'duration': 1.681}, {'end': 586.935, 'text': 'So instead of using to if, we can use if and else.', 'start': 583.573, 'duration': 3.362}, {'end': 590.216, 'text': 'It works, right? So this is how you work with if else.', 'start': 587.455, 'duration': 2.761}], 'summary': "Using 'if' and 'else' improved performance, as shown in the debug flow with r=0.", 'duration': 26.617, 'max_score': 563.599, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw563599.jpg'}], 'start': 338.858, 'title': 'Determining even or odd numbers and improving performance', 'summary': 'Covers the process of identifying even or odd numbers by checking remainders, with an example using the number 3. it also discusses the optimization of code performance through if-else statements, exemplifying the identification of even and odd numbers and the streamlining of processes to enhance code efficiency.', 'chapters': [{'end': 378.303, 'start': 338.858, 'title': 'Checking even or odd numbers', 'summary': 'Explains the process of determining whether a number is even or odd by checking if its remainder when divided by 2 is 0 or 1, illustrated with an example of taking the number 3 as input.', 'duration': 39.445, 'highlights': ['The process of determining if a number is even or odd is based on checking its remainder when divided by 2, with a remainder of 0 indicating an even number and a remainder of 1 indicating an odd number.', 'Illustrates the concept with an example of taking the number 3 as input to demonstrate the process of checking if it is an even or odd number.']}, {'end': 586.935, 'start': 378.303, 'title': 'Improving performance with if-else', 'summary': 'Discusses the use of if-else statements to optimize code performance by avoiding unnecessary checks, with examples demonstrating the identification of even and odd numbers and the use of if-else to streamline the process, ultimately improving code efficiency.', 'duration': 208.632, 'highlights': ['The chapter discusses the use of if-else statements to optimize code performance by avoiding unnecessary checks. The transcript emphasizes the importance of improving code efficiency by utilizing if-else statements to avoid redundant checks.', 'Examples demonstrating the identification of even and odd numbers and the use of if-else to streamline the process. The speaker provides examples of identifying even and odd numbers and demonstrates the use of if-else statements to streamline the code and improve performance.', 'The importance of writing efficient code and the elimination of unnecessary checks to improve performance. The transcript emphasizes the significance of writing efficient code and highlights the need to eliminate unnecessary checks in order to enhance performance.']}], 'duration': 248.077, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw338858.jpg', 'highlights': ['The process of determining if a number is even or odd is based on checking its remainder when divided by 2, with a remainder of 0 indicating an even number and a remainder of 1 indicating an odd number.', 'Illustrates the concept with an example of taking the number 3 as input to demonstrate the process of checking if it is an even or odd number.', 'The chapter discusses the use of if-else statements to optimize code performance by avoiding unnecessary checks.', 'The importance of writing efficient code and the elimination of unnecessary checks to improve performance.']}, {'end': 924.579, 'segs': [{'end': 677.313, 'src': 'embed', 'start': 647.658, 'weight': 3, 'content': [{'end': 650.1, 'text': 'so if this is true, then it will print even.', 'start': 647.658, 'duration': 2.442}, {'end': 653.784, 'text': 'then it will check for the another condition and then it will print great, right.', 'start': 650.1, 'duration': 3.684}, {'end': 657.547, 'text': 'so this is called as nested if, which is if inside the if.', 'start': 653.784, 'duration': 3.763}, {'end': 660.01, 'text': 'Now, how do you know that this is inside the if?', 'start': 657.907, 'duration': 2.103}, {'end': 661.692, 'text': 'because of indentation, right?', 'start': 660.01, 'duration': 1.682}, {'end': 664.296, 'text': 'We can have an entire tree of ifs.', 'start': 662.113, 'duration': 2.183}, {'end': 667.44, 'text': 'you know, if inside the if and if inside the if, that works.', 'start': 664.296, 'duration': 3.144}, {'end': 669.483, 'text': 'For this one also, we can write else.', 'start': 667.821, 'duration': 1.662}, {'end': 672.928, 'text': 'Now, this else is a pairing with this, if not the about.', 'start': 669.824, 'duration': 3.104}, {'end': 673.369, 'text': 'if okay?', 'start': 672.928, 'duration': 0.441}, {'end': 677.313, 'text': 'And if I say print, I would say not so great, right?', 'start': 673.729, 'duration': 3.584}], 'summary': 'Nested if statements with indentation determine code execution, allowing for complex branching and conditions.', 'duration': 29.655, 'max_score': 647.658, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw647658.jpg'}, {'end': 733.076, 'src': 'heatmap', 'start': 693.248, 'weight': 0.804, 'content': [{'end': 694.99, 'text': "Let's run this code and it works.", 'start': 693.248, 'duration': 1.742}, {'end': 695.75, 'text': 'You can see we got error.', 'start': 695.05, 'duration': 0.7}, {'end': 699.654, 'text': 'even great and buy if the value is not greater than five.', 'start': 696.391, 'duration': 3.263}, {'end': 705.058, 'text': "if it is three, let's run this code and you can see we got odd and buy because this is an odd number,", 'start': 699.654, 'duration': 5.404}, {'end': 707.84, 'text': 'it is not even going there and then it is printing all.', 'start': 705.058, 'duration': 2.782}, {'end': 708.9, 'text': 'so that works.', 'start': 707.84, 'duration': 1.06}, {'end': 711.582, 'text': 'so this is how you work with if and else.', 'start': 708.9, 'duration': 2.682}, {'end': 713.384, 'text': 'let me add one more twist here.', 'start': 711.582, 'duration': 1.802}, {'end': 716.286, 'text': 'the twist is in fact not not with this code.', 'start': 713.384, 'duration': 2.902}, {'end': 717.427, 'text': 'let me just try one more code.', 'start': 716.286, 'duration': 1.141}, {'end': 721.93, 'text': 'here we also have a concept of if, elif and else.', 'start': 717.427, 'duration': 4.503}, {'end': 723.09, 'text': 'now what that means.', 'start': 721.93, 'duration': 1.16}, {'end': 729.014, 'text': "let's say, let's take an example here if a user enters one, i want to print o and e, which is one.", 'start': 723.09, 'duration': 5.924}, {'end': 730.134, 'text': 'in what format?', 'start': 729.014, 'duration': 1.12}, {'end': 731.595, 'text': 'if a user says two, i want to print two.', 'start': 730.134, 'duration': 1.461}, {'end': 733.076, 'text': 'if a user says three, i want to print three.', 'start': 731.595, 'duration': 1.481}], 'summary': 'Demonstrating use of if-else and if-elif-else, handling odd and even numbers.', 'duration': 39.828, 'max_score': 693.248, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw693248.jpg'}, {'end': 773.832, 'src': 'embed', 'start': 746.976, 'weight': 2, 'content': [{'end': 750.3, 'text': 'if you want to put the condition, you can put that condition in round packets as well.', 'start': 746.976, 'duration': 3.324}, {'end': 751.28, 'text': 'Now what happens?', 'start': 750.7, 'duration': 0.58}, {'end': 757.303, 'text': "you know if you're coming from other programming language like C C++, Java or C Sharp, you have this tendency of using round package there.", 'start': 751.28, 'duration': 6.023}, {'end': 759.164, 'text': 'So in Python also you can use it.', 'start': 757.643, 'duration': 1.521}, {'end': 759.884, 'text': "It's optional.", 'start': 759.244, 'duration': 0.64}, {'end': 762.065, 'text': 'You want to use it or not, that is your choice.', 'start': 760.084, 'duration': 1.981}, {'end': 763.926, 'text': "What I'm talking about is this one.", 'start': 762.706, 'duration': 1.22}, {'end': 770.75, 'text': 'So if I can say if x is equal to equal to one, so instead of putting that open, you can also put that in a round bracket.', 'start': 763.946, 'duration': 6.804}, {'end': 772.791, 'text': 'but you know, open looks cool.', 'start': 770.75, 'duration': 2.041}, {'end': 773.832, 'text': "let's use that.", 'start': 772.791, 'duration': 1.041}], 'summary': 'In python, using round brackets for conditions is optional, influenced by other languages like c, c++, java, or c#.', 'duration': 26.856, 'max_score': 746.976, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw746976.jpg'}, {'end': 839.302, 'src': 'embed', 'start': 807.488, 'weight': 0, 'content': [{'end': 809.028, 'text': 'What if the value is 1?', 'start': 807.488, 'duration': 1.54}, {'end': 814.751, 'text': "and then, when you run this code, don't you think it will print 1, of course, but it will check for every other number?", 'start': 809.028, 'duration': 5.723}, {'end': 822.174, 'text': "In that case, if we don't want it to check with every other number, we can use instead of using, if we can also use elif.", 'start': 815.491, 'duration': 6.683}, {'end': 827.697, 'text': 'Now what elif means is, if this is not true, then only it will go for the next one.', 'start': 822.795, 'duration': 4.902}, {'end': 832.259, 'text': 'The same thing you can apply everywhere you can say lf and lf.', 'start': 828.297, 'duration': 3.962}, {'end': 839.302, 'text': 'So lf stands for else if so if this is false then only it will check other conditions.', 'start': 832.779, 'duration': 6.523}], 'summary': 'Using elif reduces number of checks, improving efficiency.', 'duration': 31.814, 'max_score': 807.488, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw807488.jpg'}], 'start': 587.455, 'title': 'Using if and else in python', 'summary': 'Discusses using if and else statements in python, including nested if, elif, and else, and emphasizes the usage of colons and optional round brackets for conditions, illustrating through examples and code explanations. it also demonstrates working with if, elif, and else statements, showcasing how to use them to execute different blocks of code based on specific conditions, including examples with values 1, 2, 3, 4, and 5.', 'chapters': [{'end': 763.926, 'start': 587.455, 'title': 'Working with if and else in python', 'summary': 'Discusses working with if and else statements in python, including nested if, elif, and else, and emphasizes the usage of colons and optional round brackets for conditions, illustrating through examples and code explanations.', 'duration': 176.471, 'highlights': ['The chapter emphasizes the usage of colons when using if else statements, as it is a mandatory requirement for the code to work. The usage of colons is emphasized when using if else statements, as it is a mandatory requirement for the code to work.', 'The chapter explains the concept of nested if, providing an example and highlighting the importance of indentation to indicate the nested structure. The chapter explains the concept of nested if, providing an example and highlighting the importance of indentation to indicate the nested structure.', 'The chapter introduces the concept of elif and demonstrates its usage through an example, showcasing the ability to handle multiple conditions using elif. The chapter introduces the concept of elif and demonstrates its usage through an example, showcasing the ability to handle multiple conditions using elif.', 'The chapter discusses the optional usage of round brackets for conditions, stating that it is optional and a matter of personal choice, with a comparison to other programming languages such as C, C++, Java, and C#. The chapter discusses the optional usage of round brackets for conditions, stating that it is optional and a matter of personal choice, with a comparison to other programming languages such as C, C++, Java, and C#.']}, {'end': 924.579, 'start': 763.946, 'title': 'Working with if, elif, and else', 'summary': 'Demonstrates working with if, elif, and else statements, showcasing how to use them to execute different blocks of code based on specific conditions, including examples with values 1, 2, 3, 4, and 5.', 'duration': 160.633, 'highlights': ['The chapter provides examples of using if, elif, and else statements to execute different blocks of code based on specific conditions, including examples with values 1, 2, 3, 4, and 5.', "It demonstrates the use of 'elif' to check for conditions if the previous 'if' statement is not true, and 'else' to execute a block of code when none of the previous conditions are met.", 'The tutorial encourages trying out different combinations and ends with a call to action for viewers to try the assignment and share their thoughts on if, elif, and else.']}], 'duration': 337.124, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PqFKRqpHrjw/pics/PqFKRqpHrjw587455.jpg', 'highlights': ['The chapter introduces the concept of elif and demonstrates its usage through an example, showcasing the ability to handle multiple conditions using elif.', 'The chapter provides examples of using if, elif, and else statements to execute different blocks of code based on specific conditions, including examples with values 1, 2, 3, 4, and 5.', 'The chapter discusses the optional usage of round brackets for conditions, stating that it is optional and a matter of personal choice, with a comparison to other programming languages such as C, C++, Java, and C#.', 'The chapter explains the concept of nested if, providing an example and highlighting the importance of indentation to indicate the nested structure.']}], 'highlights': ["The logical unit in Python's CPU, involving the usage of if statements to specify the flow of execution based on conditions, is explained, with examples illustrating the execution of code blocks based on true or false conditions.", 'The concept of indentation in Python, used to specify code blocks related to if statements, is detailed, with the demonstration of how indentation impacts the execution of code and the necessity of maintaining consistent indentation.', 'The process of determining if a number is even or odd is based on checking its remainder when divided by 2, with a remainder of 0 indicating an even number and a remainder of 1 indicating an odd number.', 'The chapter introduces the concept of elif and demonstrates its usage through an example, showcasing the ability to handle multiple conditions using elif.', 'The chapter provides examples of using if, elif, and else statements to execute different blocks of code based on specific conditions, including examples with values 1, 2, 3, 4, and 5.', 'The importance of writing efficient code and the elimination of unnecessary checks to improve performance.']}