List Comprehension in Python ЁЯРН with Execution | Best Python Tutorials for Beginners

Gate Smashers
23 Oct 202305:35

Summary

TLDRIn this educational video, the concept of list comprehension is introduced as a method to efficiently write concise code, enhancing performance by reducing code size. The video uses a teacher's scenario to demonstrate how list comprehension can be used to increment student marks and find cube roots of even numbers within a range. It compares traditional looping methods with list comprehension, showcasing a significant reduction in lines of code and an improvement in execution speed, making it a valuable tool for students and developers alike.

Takeaways

  • ЁЯША The video aims to explain list comprehension, a feature in Python that allows for more concise and efficient coding.
  • ЁЯУЪ List comprehension is used to create a new list by applying an operation to each item in an existing list.
  • ЁЯФН The script uses an example of a teacher who needs to add extra marks to students' scores, demonstrating how list comprehension can simplify this task.
  • ЁЯТб The video highlights that using list comprehension can lead to a decrease in code size, potentially improving performance.
  • ЁЯУИ The script provides a step-by-step example of how to increment each value in a list by two using list comprehension.
  • ЁЯУЭ The video contrasts traditional for-loop methods with list comprehension, showing the latter's efficiency and conciseness.
  • ЁЯФв An example is given where the script calculates the cube of numbers from 1 to 10 that are even, using both a for-loop and list comprehension.
  • ЁЯЪА The video emphasizes the importance of understanding the 'for', 'what', and 'where' aspects of list comprehension to use it effectively.
  • ЁЯУК The script concludes by comparing the efficiency of code written with list comprehension versus traditional methods, showing a significant improvement.
  • ЁЯТм The video suggests that knowledge of list comprehension can be beneficial in interviews and exams, as it's a valuable Python feature to know.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is about list comprehension in Python, which is a concise way to create lists and improve code performance.

  • Why is list comprehension used in Python?

    -List comprehension is used in Python to make the code more concise, readable, and efficient. It reduces the size of the code and improves performance by reducing the number of lines.

  • How does list comprehension improve the performance of code?

    -List comprehension improves performance because it is optimized for creating lists and can execute faster than a regular for-loop with append operations.

  • What is an example given in the video to demonstrate list comprehension?

    -An example given in the video is incrementing each value in a list of student marks by two using list comprehension.

  • How does the teacher in the video handle a situation where two questions are out of syllabus?

    -The teacher in the video decides to give extra marks to the students for the two out of syllabus questions by adding two to each of their marks using list comprehension.

  • What is the benefit of using list comprehension over a traditional for-loop?

    -Using list comprehension over a traditional for-loop can reduce the number of lines of code, making it more efficient and easier to understand.

  • Can you explain the concept of 'incrementing' as used in the video?

    -In the context of the video, 'incrementing' refers to the process of adding a fixed value (in this case, two) to each element in a list.

  • What is the output of the code example where the teacher increments each student's marks by two?

    -The output of the code example is a new list where each mark has been increased by two, demonstrating the use of list comprehension to modify list values.

  • How does the video explain the concept of 'even numbers' in the context of list comprehension?

    -The video explains the concept of 'even numbers' by checking if a number is divisible by 2 using a condition within the list comprehension to find the cube of only even numbers in a given range.

  • What is the final output of the cube-finding example in the video?

    -The final output of the cube-finding example is a list of cubes of even numbers from 0 to 10, demonstrating the use of list comprehension to perform operations conditionally.

  • How does the video compare the efficiency of traditional for-loops with list comprehension?

    -The video compares the efficiency by showing a reduction in the number of lines of code and an improvement in performance when using list comprehension over traditional for-loops.

Outlines

00:00

ЁЯУЪ Understanding List Comprehension and its Benefits

The speaker introduces list comprehension and its significance in writing concise and efficient code. They explain that using list comprehension reduces the number of lines in a program, leading to better performance and cleaner code. An example is provided: a teacher wants to give two extra marks to each student, and instead of using a loop with multiple lines, list comprehension simplifies the task. The method involves incrementing values with a single line of code (x + 2 for x in marks), reducing the code length from five lines to three.

05:00

ЁЯУК Efficiency Gains with List Comprehension

This section delves into the efficiency improvements achieved through list comprehension. The speaker explains that by reducing the number of code lines from five to two, a significant improvement in efficiency can be calculated. Using the formula (new lines/old lines * 100), the speaker demonstrates a 60% improvement. This method is recommended for interviews, exams, or university projects due to its simplicity and effectiveness in enhancing code performance.

Mindmap

Keywords

ЁЯТбList Comprehension

List comprehension is a concise way to create lists in Python. It consists of brackets containing an expression followed by a 'for' clause, then zero or more 'for' or 'if' clauses. In the video, the concept is used to demonstrate how to efficiently create a new list by adding two to each element in an existing list of student marks. This is a core concept in the video, illustrating a best practice in Python for writing more concise and readable code.

ЁЯТбPerformance

Performance in the context of the video refers to the efficiency and speed of code execution. The video script suggests that by using list comprehension, the size of the code decreases, which can lead to improved performance. The script implies that less code can sometimes mean less overhead, resulting in faster execution, which is a common consideration in software development.

ЁЯТбCode Size

Code size is the amount of space a piece of code occupies, often measured in lines of code. The video emphasizes that by using list comprehension, the size of the code can be reduced. This is exemplified when the script describes how adding two to each mark in a list of student marks can be done in a single line using list comprehension, as opposed to a multi-line loop, thus reducing the code size.

ЁЯТбIncrement

Incrementing in programming refers to the operation of increasing a variable's value by a fixed amount, typically one. In the video, the concept is used when explaining how to add two to each value in a list of student marks, showcasing how list comprehension can be used to perform this operation in an efficient manner.

ЁЯТбLoop

A loop is a programming construct that allows code to be executed repeatedly based on a condition. The video script contrasts the use of a loop with list comprehension, showing that while a loop might be used to increment each value in a list, list comprehension provides a more concise alternative.

ЁЯТбSyntax

Syntax refers to the set of rules that governs the structure of a programming language. The video discusses the syntax of list comprehension, which is a specific way to write code in Python. The script uses the term to explain how to correctly write list comprehensions to achieve the desired outcome of creating a new list based on an existing one.

ЁЯТбCube

In the context of the video, 'cube' refers to the third power of a number. The script uses this term when explaining how to find the cube of numbers within a range that are even. This serves as an example of how list comprehension can be used to perform mathematical operations on a set of values.

ЁЯТбRange

A range in programming, particularly in Python, is a sequence of numbers. The video script mentions creating a list of numbers from 1 to 10 and then finding the cube of even numbers within this range. The concept of range is integral to understanding how list comprehension can iterate over a set of values.

ЁЯТбEven Number

An even number is an integer that is exactly divisible by two. In the video, the script discusses finding the cube of even numbers within a given range. This concept is used to demonstrate conditional logic within list comprehension, where only numbers that meet the condition (being even) are processed.

ЁЯТбRemainder

The remainder is the amount left over after division of one number by another. In the video, the concept is used to determine if a number is even by checking if the remainder of the division by two is zero. This is part of the conditional logic within the list comprehension example provided in the script.

ЁЯТбEfficiency

Efficiency in programming refers to the ability to perform tasks with minimal use of resources, such as time and memory. The video script highlights the efficiency of list comprehension by comparing it to traditional looping constructs, suggesting that it not only reduces code size but also can improve the efficiency of the code.

Highlights

Explains list comprehension basics, a method used to write concise and efficient code.

Discusses how list comprehension can improve performance by reducing code size.

Provides an example of incrementing all values in a list by two using list comprehension.

Illustrates the concept with a simple example of a teacher adding extra marks to student scores.

Demonstrates how to create a new list by adding a fixed value to each element in an existing list.

Explains the syntax and usage of list comprehension with a practical example.

Shows how to use list comprehension to find cube roots of even numbers in a range.

Uses a conditional statement within list comprehension to filter out non-even numbers.

Compares the efficiency of traditional loops versus list comprehension.

Provides a step-by-step guide on how to implement list comprehension for cube root calculation.

Mentions the reduction in the number of lines of code as a result of using list comprehension.

Discusses the concept of efficiency in coding and how list comprehension contributes to it.

Gives a real-world example of how list comprehension can be used to solve a problem in an educational context.

Explains the concept of list comprehension with a simple and relatable example of student marks.

Demonstrates the use of list comprehension to perform operations on a range of values.

Provides a comparison between the output of traditional loops and list comprehension.

Calculates the improvement percentage in code efficiency when using list comprehension.

Encourages the use of list comprehension in interviews and exams for a concise and efficient answer.

Transcripts

play00:00

рдбрд┐рдпрд░ рд╕реНрдЯреВрдбреЗрдВрдЯреНрд╕ рд╡реЗрд▓рдХрдо рдЯреВ рдЧреЗрдЯреНрд╕ рдорд╢рд░реНрд╕ рдЖрдЬ

play00:01

рдХреА рдЗрд╕ рд╡реАрдбрд┐рдпреЛ рдореЗрдВ рдПрдХреНрд╕рдкреНрд▓реЗрди рдХрд░рдиреЗ рдЬрд╛ рд░рд╣рд╛

play00:03

рд╣реВрдВ рд▓рд┐рд╕реНрдЯ рдХреЙрдореНрдкреНрд░рд┐рдВрдЯ рдХрдВрдкреНрд░реАрд╣реЗрдВрд╢рди рдмреЗрд╕рд┐рдХрд▓реА

play00:06

рдпреВрдЬрд╝ рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ рдХреЛрдб рдХреЛ рдХрдВ рд╕рд╛рдЗрдЬ рд╡реЗ рд╕реЗ

play00:08

рдмреЗрд╕реНрдЯ рддрд░реАрдХреЗ рд╕реЗ рд▓рд┐рдЦрдиреЗ рдХреЗ рд▓рд┐рдП рдФрд░ рдЗрд╕рд╕реЗ рд╣реЛрдЧрд╛

play00:11

рдХреНрдпрд╛ рдЗрд╕рд╕реЗ рдкрд░рдлреЙрд░реНрдореЗрдВрд╕ рдЬреЛ рд╣реИ рд╡реЛ рдЗрдВрдХреНрд░реАрдЬ

play00:13

рд╣реЛрддреА рд╣реИ рдХреЛрдб рдХрд╛ рд╕рд╛рдЗрдЬ рдбрд┐рдХреНрд░реАрдЬ рд╣реЛ рдЬрд╛рддрд╛ рд╣реИ

play00:15

рддреЛ рдУрдмрд╡рд┐рдпрд╕рд▓реА рдкрд░рдлреЙрд░реНрдореЗрдВрд╕ рдХрд╣реАрдВ рдирд╛ рдХрд╣реАрдВ рдореЗрд░реА

play00:17

рдЗрдВрдХреНрд░реАрдЬ рд╣реЛ рдЬрд╛рддреА рд╣реИ рдФрд░ рд▓рд┐рдЦрдиреЗ рдХрд╛ рддрд░реАрдХрд╛ рднреА

play00:19

рдпреЗ рдХрд╣реАрдВ рдирд╛ рдХрд╣реАрдВ рдмреЗрд╕реНрдЯ рд╣реЛ рдЬрд╛рддрд╛ рд╣реИ рдХреНрдпреЛрдВрдХрд┐

play00:20

рдирдВрдмрд░ рдСрдл рд▓рд╛рдЗрдВрд╕ рдЬреЛ рдореЗрд░реА рдХрдо рд╣реЛ рдЬрд╛рдПрдВрдЧреА рддреЛ

play00:23

рдЕрдкрдиреЗ рдЖрдк рд╣реА рдПрдХ рдЕрдЪреНрдЫреЗ рддрд░реАрдХреЗ рд╕реЗ рд╣рдо рдЙрд╕рдХреЛ

play00:24

рд░рд┐рдкреНрд░реЗрдЬреЗрдВрдЯ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ рддреЛ рджреЗрдЦреЛ рдПрдХ рд╕рд┐рдВрдкрд▓

play00:26

рд╕реЗ рдПрдЧреНрдЬрд╛рдВрдкрд▓ рд╕реЗ рд╕реНрдЯрд╛рд░реНрдЯ рдХрд░рддреЗ рд╣реИрдВ рд▓реЗрдЯреНрд╕

play00:28

рд╕рдкреЛрдЬ рдореИрдВ рдПрдХ рдЯреАрдЪрд░ рд╣реВрдВ рдХрд┐рд╕реА рд╕реНрдХреВрд▓ рдореЗрдВ рдФрд░

play00:30

рдореИрдВрдиреЗ рдХреНрдпрд╛ рдХрд┐рдпрд╛ рд╕реНрдЯреВрдбреЗрдВрдЯреНрд╕ рдХреЗ рдорд╛рд░реНрдХреНрд╕ рдЬреЛ

play00:32

рд╣реИрдВ рд╡реЛ рдПрдХ рд▓рд┐рд╕реНрдЯ рддреИрдпрд╛рд░ рдХреА рд╣реИ рдЬрд┐рд╕рдореЗрдВ

play00:33

рд╕реНрдЯреВрдбреЗрдВрдЯреНрд╕ рдХреЗ рдорд╛рд░реНрдХреНрд╕ рдореИрдВрдиреЗ рдмрдирд╛ рд▓рд┐рдП рдЕрдм

play00:35

рд▓реЗрдЯреНрд╕ рд╕рдкреЛрдЬ рдореЗрд░реЗ рдХреЛ рдкрддрд╛ рд▓рдЧрд╛ рдХрд┐ рдпрд╛рд░ рдЗрд╕

play00:37

рдореЗрд░реЗ рдЬреЛ рдХреНрд╡реЗрд╢реНрдЪрди рдкреЗрдкрд░ рдерд╛ рдЙрд╕рдореЗрдВ рджреЛ

play00:39

рдХреНрд╡реЗрд╢реНрдЪрди рдЬреЛ рд╣реИ рд╡реЛ рдЖрдЙрдЯ рдСрдл рд╕рд┐рд▓реЗрдмрд╕ рдереЗ рдпрд╛

play00:41

рдЧрд▓рдд рдереЗ рддреЛ рдореЗрд░реЗ рдХреЛ рдХреНрдпрд╛ рдХрд░рдирд╛ рдкрдбрд╝реЗрдЧрд╛

play00:42

рд╕реНрдЯреВрдбреЗрдВрдЯреНрд╕ рдХреЛ рджреЛ рдорд╛рд░реНрдХреНрд╕ рдЬреЛ рд╣реИ рд╡реЛ рд▓реЗрдЯреНрд╕

play00:44

рд╕рдкреЛрдЬ рдПрдХреНрд╕реНрдЯреНрд░рд╛ рджреЗрдиреЗ рд╣реИрдВ рддреЛ рдореИрдВрдиреЗ рдХреНрдпрд╛

play00:46

рдХрд┐рдпрд╛ рдЬрд┐рддрдиреА рдореЗрд░реА рд▓рд┐рд╕реНрдЯ рдереА рдЙрд╕рдореЗрдВ рд╣рд░ рдПрдХ рдЬрдЧрд╣

play00:48

рдкреЗ рдЬрд╛рдХреЗ рджреЛ рдирдВрдмрд░ рдореИрдВрдиреЗ рдПрдХреНрд╕реНрдЯреНрд░рд╛ рдРрдб рдХрд░

play00:51

рджрд┐рдП рддреЛ рджреЗрдЦреЛ рдпрд╣рд╛рдВ рдкреЗ рдХреНрдпрд╛ рдХрд┐рдпрд╛ рдореИрдВрдиреЗ

play00:52

рд▓рд┐рд╕реНрдЯ рдХреНрд░рд┐рдПрдЯ рдХреА рд╣реБрдИ рд╣реИ рдФрд░ рдЙрд╕рдореЗрдВ рдмрд╛ рдЙрд╕рдХреЗ

play00:54

рдмрд╛рдж рдореИрдВрдиреЗ рдХреНрдпрд╛ рдХрд┐рдпрд╛ рдПрдХ рдХреЛрдб рдХреЗ рдереНрд░реВ рдПрдХ

play00:57

рд╕рд┐рдВрдкрд▓ рд╕реЗ рдХреЛрдб рдХреЗ рдереНрд░реВ рдореИрдВрдиреЗ рд▓реВрдк рдХреЗ рдереНрд░реВ

play00:59

рдореИрдВрдиреЗ рд╣ рд╣рд░ рдПрдХ рд╡реИрд▓реНрдпреВ рдореЗрдВ рдЬрд╛рдХреЗ рджреЛ рдХрд╛

play01:01

рдЗрдВрдХреНрд░реАрдореЗрдВрдЯ рдХрд┐рдпрд╛ рддреЛ рдХреИрд╕реЗ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ

play01:03

рд▓реЗрдЯреНрд╕ рд╕рдкреЛрдЬ рдореЗрд░реЗ рдкрд╛рд╕ рдПрдХ рдорд╛рд░реНрдХреНрд╕ рдХреА рд▓рд┐рд╕реНрдЯ

play01:05

рд╣реИ рдФрд░ рдореИрдВрдиреЗ рдПрдХ рдиреНрдпреВ рд▓рд┐рд╕реНрдЯ рдХреНрд░рд┐рдПрдЯ рдХреА

play01:07

рдЬрд┐рд╕рдореЗрдВ рдореИрдВрдиреЗ рдХреНрдпрд╛ рдХрд┐рдпрд╛ рд╣рд░ рдПрдХ рдорд╛рд░реНрдХреНрд╕ рдореЗрдВ

play01:09

рджреЛ-рджреЛ рд╡реИрд▓реНрдпреВрдЬ рдХреЛ рдРрдб рдХрд░рдХреЗ рдПрдХ рдирдИ рд▓рд┐рд╕реНрдЯ рдХреЛ

play01:12

рдкреНрд░рд┐рдВрдЯ рдХрд░ рджрд┐рдпрд╛ рд╕рд┐рдВрдкрд▓ рдХреБрдЫ рднреА рдирд╣реАрдВ рд╣реИ

play01:13

рдЗрд╕рдореЗрдВ рд╕рд┐рдВрдкрд▓ рд╕рд╛ рдЖрдк рдЗрд╕ рддрд░реАрдХреЗ рд╕реЗ рд▓рд┐рдЦ рд╕рдХрддреЗ

play01:15

рд╣реЛ рдФрд░ рдЗрд╕рдХреЛ рдЖрдк рдПрдЧреНрдЬреАрдХреНрдпреВрдЯ рдХрд░рддреЗ рд╣реЛ рддреЛ

play01:17

рдПрдЧреНрдЬреАрдХреНрдпреВрдЯ рднреА рдЗрдЬрд▓реА рдХрд░ рд╕рдХрддреЗ рд╣реЛ рддреЛ рдЗрд╕рдиреЗ

play01:19

рдХреНрдпрд╛ рдХрд┐рдпрд╛ рдЬрд┐рддрдиреА рдореЗрд░реЗ рд▓рд┐рд╕реНрдЯ рдореЗрдВ рдкрд╣рд▓реЗ

play01:21

рдорд╛рд░реНрдХреНрд╕ рдереЗ рдЙрдирдореЗрдВ рд╣рд░ рдПрдХ рдореЗрдВ рджреЛ-рджреЛ рд╡реИрд▓реНрдпреВрдЬ

play01:23

рдХреЛ рдЗрдВрдХреНрд░реАрдореЗрдВрдЯ рдХрд░рдХреЗ рдФрд░ рдЙрд╕рдХреЛ рдкреНрд░рд┐рдВрдЯ рдХрд░

play01:25

рджрд┐рдпрд╛ рд▓реЗрдХрд┐рди рдпрд╣рд╛рдВ рдкреЗ рд▓рд┐рд╕реНрдЯ рдХреЙрдореНрдкреНрд░рд┐рдВрдЯ рд╣реБрдЖ

play01:30

рддреЛ рджреЗрдЦреЛ рдпрд╣рд╛рдВ рдкреЗ рдореИрдВрдиреЗ 1 2 3 4 5 рдкрд╛рдВрдЪ

play01:33

рд▓рд╛рдЗрдВрд╕ рдЬреЛ рд╣реИ рд╡реЛ рдпрд╣рд╛рдВ рдкреЗ рд▓рд┐рдЦреА рд╣реИ рдорддрд▓рдм рд▓рд╛рдЗрди

play01:34

рдСрдл рдХреЛрдб рдЖрдк рдХрд╣ рд╕рдХрддреЗ рд╣реЛ рдпрд╣рд╛рдВ рдкреЗ рдлрд╛рдЗрд╡ рд╣реИ

play01:36

рд▓реЗрдХрд┐рди рдЗрд╕реА рддрд░реАрдХреЛ рд▓рд┐рд╕реНрдЯ рдХрдВрдкреНрд░реАрд╣реЗрдВрд╢рди рдХреНрдпрд╛

play01:39

рдХрд╣рддрд╛ рд╣реИ рдЖрдк рд░рд┐рдбреНрдпреВрд╕ рддрд░реАрдХреЗ рд╕реЗ рднреА рд▓рд┐рдЦ рд╕рдХрддреЗ

play01:41

рд╣реЛ рдХреИрд╕реЗ рдорд╛рд░реНрдХреНрд╕ рдореЗрд░реЗ рд╡рд╣реА рдЬреЛ рдореЗрд░реЗ рдереА

play01:43

рд▓рд┐рд╕реНрдЯ рдЕрдм рдореИрдВрдиреЗ рдХреНрдпрд╛ рдХрд┐рдпрд╛ рдиреНрдпреВ рдорд╛рд░реНрдХреНрд╕ =

play01:46

x + 2 рджреИрдЯ рдЗрдЬ рдХреЙрд▓реНрдб рдж рд▓рд┐рд╕реНрдЯ

play01:52

рдХрдВрдкреНрд░рд┐рд╣реЗрдВрд╕рд┐рд╡ рд╣реИ x рд▓реЗ рд▓реЛ y рд▓реЗ рд▓реЛ рдпреЗ рдЬрд╕реНрдЯ

play01:55

рдПрдХ рдкреЙрдЗрдВрдЯрд░ рдХреА рддрд░рд╣ рд╡рд░реНрдХ рдХрд░ рд░рд╣рд╛ рд╣реИ рдХрд┐ рдЖрдкрдХреЛ

play01:57

рд▓рд┐рд╕реНрдЯ рдореЗрдВ рдПрдХ-рдПрдХ рдХрд░рдХреЗ рд╣рд░ рдЬрдЧрд╣ рдкреЗ рдЬрд╛рдХреЗ рдЬреЛ

play01:59

рд╣реИ рд╣реИ рд╡реЛ рд╡реИрд▓реНрдпреВ рдХреЛ рдЗрдВрдХреНрд░реАрдореЗрдВрдЯ рдХрд░рдирд╛ рд╣реИ

play02:01

рдлреЙрд░ рдпрд╣рд╛рдВ рдкреЗ рдореИрдВрдиреЗ рдХрд┐рдпрд╛ x + 2 рдлреЙрд░ x рдорддрд▓рдм

play02:04

рдХрд┐рд╕рдХреЗ рд▓рд┐рдП рдХрд░рдирд╛ рд╣реИ рдпреЗ рдЪреАрдЬ рдореЗрд░реЗ рдХреЛ рдХрд░рдиреА рд╣реИ

play02:06

рдХрд┐рд╕рдХреЗ рд▓рд┐рдП рдХрд░рдиреА рд╣реИ x рдФрд░ рдХрд╣рд╛рдВ рдкреЗ рдХрд░рдиреА рд╣реИ

play02:09

рдЗрди рдорд╛рд░реНрдХреНрд╕ рддреЛ рдЖрдк рдЗрд╕рдХреЛ рд╕рд┐рдВрдкрд▓ рдпрд╛рдж рд░рдЦ рд╕рдХрддреЗ

play02:12

рд╣реЛ рдХрд░рдирд╛ рдХреНрдпрд╛ рд╣реИ рднреИрдпрд╛ рдХрд┐рд╕рдХреЗ рд▓рд┐рдП рдХрд░рдирд╛ рд╣реИ

play02:14

рдФрд░ рдХрд╣рд╛рдВ рдЬрд╛рдХреЗ рдХрд░рдирд╛ рд╣реИ рддреЛ рдЖрдкрдХреЛ рдорд╛рд░реНрдХреНрд╕ рдореЗрдВ

play02:17

рдЬрд╛рдХреЗ рдХрд░рдирд╛ рд╣реИ x + 2 рд╣рд░ рдПрдХ x рдореЗрдВ рдЬрд╛рдХреЗ x +

play02:20

2 рдХрд░ рджреЛ рдорддрд▓рдм рдпрд╣рд╛рдВ рдкреЗ x рд╣реИ x + 2 рд╡реИрд▓реНрдпреВ

play02:22

рдХреЛ рджреЛ рдмрдврд╝рд╛ рджреЛ x рд╣реИ x + 2 рдХрд░ рджреЛ x + 2 x +

play02:25

2 рдорд╛рд░реНрдХреНрд╕ рд╡рд╛рд▓реА рд▓рд┐рд╕реНрдЯ рдореЗрдВ рдЬрд╛рдХреЗ рддреЛ рдЗрд╕рдХреЛ рдЖрдк

play02:27

рдЕрдЧрд░ рдЗрд╕ рддрд░реАрдХреЗ рд╕реЗ рд▓рд┐рдЦрддреЗ рд╣реЛ рддреЛ рдХрдВ рд╕рд╛рдЗрдЬ рд╡реЗ

play02:30

рдПрдХ рдЕрдЪреНрдЫрд╛ рддрд░реАрдХрд╛ рд╣реИ рд▓рд┐рдЦрдиреЗ рдХрд╛ рдФрд░ рдпреЗ рдХреНрдпрд╛ рдХрд░

play02:32

рджреЗрдЧрд╛ рдПрдЬ рдЗрдЯ рдЗрдЬ рдЖрдЙрдЯрдкреБрдЯ рджреЗрдЧрд╛ рд▓реЗрдХрд┐рди рдпрд╣рд╛рдВ рдкреЗ

play02:34

рдореЗрд░рд╛ рд▓рд╛рдЗрди рдСрдл рдХреЛрдб рдЬреЛ рд╣реИ рд╡реЛ рдпрд╣рд╛рдВ рдкреЗ рдлрд╛рдЗрд╡

play02:37

рдерд╛ рдпрд╣рд╛рдВ рдкреЗ рд░рд┐рдбреНрдпреВрд╕ рд╣реЛрдХреЗ рдХреНрдпрд╛ рд╣реЛ рдЧрдпрд╛ рдереНрд░реА

play02:39

рдПрдХ рдФрд░ рд╕рд┐рдВрдкрд▓ рд╕рд╛ рдПрдЧреНрдЬрд╛рдВрдкрд▓ рд▓реЗ рд▓реЗрддреЗ рд╣реИрдВ

play02:40

рд▓реЗрдЯреНрд╕ рд╕рдкреЛрдЬ рдореИрдВрдиреЗ рдХреНрдпреВрдм рдХреНрдпреВрдм рдЬреЛ рд╣реИ рд╡реЛ

play02:43

рдореЗрд░реЗ рдХреЛ рдпрд╣рд╛рдВ рдкреЗ рдПрдХ рд╕рд┐рдВрдкрд▓ рд╕рд╛ рдЕрдЧрд░

play02:45

рдкреНрд░реЛрдЧреНрд░рд╛рдо рдЖ рдЬрд╛рдП рдХрд┐ рдпрд╛рд░ рдореЗрд░реЗ рдХреЛ рдПрдХ рд╕реЗ 10

play02:47

рддрдХ рд╡реИрд▓реНрдпреВрдЬ рдЬреЛ рд╣реИ рд╡реЛ рдЙрди рд╕рдм рдореЗрдВ рдЬрд┐рддрдиреЗ рднреА

play02:49

рдореЗрд░реЗ рдЗрд╡рди рдирдВрдмрд░ рд╣реИрдВ рдЙрдирдХрд╛ рдХреНрдпреВрдм рд░реВрдЯ рдлрд╛рдЗрдВрдб

play02:51

рдЖрдЙрдЯ рдХрд░рдирд╛ рд╣реИ рд╕реЙрд░реА рдХреНрдпреВрдм рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░рдирд╛ рд╣реИ

play02:53

рддреЛ рдпрд╣рд╛рдВ рдкреЗ рдореИрдВрдиреЗ рдХреНрдпрд╛ рдХрд┐рдпрд╛ рдХреНрдпреВрдм рд▓реЗ рд▓рд┐рдпрд╛

play02:55

рдореИрдВрдиреЗ рдПрдХ рд╕рд┐рдВрдкрд▓ рд╕реА рд▓рд┐рд╕реНрдЯ рдХреНрд░рд┐рдПрдЯ рдХрд░ рджреА рдлреЙрд░

play02:57

x рдЗрди рд░реЗрдВрдЬ 10 рддреЛ рдпрд╣рд╛рдВ рдкреЗ рдХреЛрдИ рднреА рдЖрдк рджреЗ

play03:01

рд╕рдХрддреЗ рд╣реЛ 11 рдХрд░ рд▓реЛ рддрд╛рдХрд┐ рд╡рди рд╕реЗ рд▓реЗрдХреЗ 10 рддрдХ

play03:03

рдЬреЛ рд╣реИ рд╡реЛ рдкреВрд░рд╛ рдЪрд▓реЗ рдЗрдл x рдкрд░ 2 рдЗрдЬ рдбрдмрд▓ рдЗрдХреНрд╡рд▓

play03:07

рдЯреВ 0 рдорддрд▓рдм рдпрд╣рд╛рдВ рдкреЗ рдХреНрдпрд╛ рдХрд░ рд░рд╣рд╛ рд╣реВрдВ рдореИрдВ рдХрд┐

play03:09

рдЪреЗрдХ рдХрд░ рд░рд╣рд╛ рд╣реВрдВ рдХрдВрдбреАрд╢рди рдХрд┐ рдХреНрдпрд╛ рд╡реЛ рдЗрд╡рди

play03:11

рдирдВрдмрд░ рд╣реИ рдпрд╛ рдирд╣реАрдВ рддреЛ рдЙрд╕рдХреЗ рд▓рд┐рдП рдХреНрдпрд╛ рдХрд░рддреЗ

play03:13

рд╣реИрдВ рд╣рдо рд░рд┐рдорд╛рдЗрдВрдбрд░ рдЪреЗрдХ рдХрд░рддреЗ рд╣реИрдВ рдЬреИрд╕реЗ рд╕рдмрд╕реЗ

play03:15

рдкрд╣рд▓реЗ рдЬреАрд░реЛ рдЖрдпрд╛ рддреЛ 0 рдкрд░ 2 0 рдХреЛ рдЯреВ рд╕реЗ

play03:17

рдбрд┐рд╡рд╛рдЗрдб рдХрд░реЛрдЧреЗ рд░рд┐рдорд╛рдЗрдВрдбрд░ рд░реЛ рд╣реА рдЖрдПрдЧрд╛ рддреЛ рдпрд╛рдиреА

play03:19

рдпреЗ рдореЗрд░рд╛ рдЗрд╡рди рдирдВрдмрд░ рд╣реИ рддреЛ рдЙрд╕рдХрд╛ рдХреНрдпрд╛ рдХрд░ рджреЗрдЧрд╛

play03:21

рд╡реЛ рдХреНрдпреВрдм рдЬреЛ рд╣реИ рд╡реЛ рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░ рд▓реЗрдЧрд╛ рдлрд┐рд░

play03:24

рдРрд╕реЗ рд╣реА рд╡рди 1 рдкрд░ 2 рдЗрдЬ рдбрдм рдЗрд╡ рдЯ 0 рд╡рди рдХреЛ рдЕрдЧрд░

play03:27

рдЖрдк рдЯреВ рд╕реЗ рдбрд┐рд╡рд╛рдЗрдб рдХрд░рддреЗ рд╣реЛ рддреЛ рдЖрдЙрдЯрдкреБрдЯ рдХреНрдпрд╛

play03:29

рдЖрдПрдЧреА рд░рд┐рдорд╛рдЗрдВрдбрд░ рдХреНрдпрд╛ рдЖрдПрдЧрд╛ рд╡рди рдЖрдПрдЧрд╛ рддреЛ рдпрд╛рдиреА

play03:31

рдпреЗ рдЖрдЙрдЯрдкреБрдЯ рдореЗрдВ рдирд╣реАрдВ рдЖрдПрдЧрд╛ рддреЛ рдпреЗ рдпрд╣рд╛рдВ рд╕реЗ

play03:32

рд╕реНрдХрд┐рдк рдХрд░ рджреЗрдЧрд╛ рджреЗрди рдЯреВ 2 рдкрд░ 2 рдЗрдЬ рдб рдЗ 0

play03:36

рдЯреНрд░реВ рдЯреНрд░реВ рд╣реЛ рдЧрдпрд╛ рддреЛ рдпрд╛рдиреА рдЕрдВрджрд░ рдЬрд╛рдПрдЧрд╛ рдЯреВ

play03:38

рдХрд╛ рдХреНрдпреВрдм рд░реВрдЯ рдЬреЛ рд╣реИ рд╡реЛ рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░ рд▓реЗрдЧрд╛

play03:40

рдЗрд╕ рддрд░реАрдХреЗ рд╕реЗ рдПрдХ-рдПрдХ рдХрд░рдХреЗ рд╡реИрд▓реНрдпреВрдЬ рдХрд╛ рдЬреЛ рднреА

play03:42

рдЖрдк рд░реЗрдВрдЬ рджреЛрдЧреЗ рдЙрд╕рдХреЗ рд╣рд┐рд╕рд╛рдм рд╕реЗ рдЬреЛ рд╣реИ рд╡реЛ рдХреНрдпреВ

play03:44

рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░ рд▓реЗрдЧрд╛ рддреЛ рдЕрдЧрд░ рдореИрдВ рдЗрд╕рдХрд╛ рдЖрдЙрдЯрдкреБрдЯ

play03:47

рдЬреЛ рд╣реИ рд╡реЛ рдЪреЗрдХ рдХрд░рддрд╛ рд╣реВрдВ рддреЛ рдареАрдХ рд╣реИ рдЬреА рдореИрдВ

play03:49

рдпрд╣рд╛рдВ рдкреЗ рдЖрдЙрдЯрдкреБрдЯ рдЬреЛ рд╣реИ рд╡реЛ рдЪреЗрдХ рдХрд░ рд╕рдХрддрд╛ рд╣реВрдВ

play03:51

рддреЛ рдЖрдЙрдЯрдкреБрдЯ рдореЗрд░реЗ рдкрд╛рд╕ рдпрд╣рд╛рдВ рдкреЗ рдХреНрдпрд╛ рдЖрдИ рдпреЗ

play03:53

рджреЗрдЦ рд▓реЛ 08 64 216 5 12 рдорддрд▓рдм рдпреЗ рд╕рд╛рд░реЗ

play03:57

рдирдВрдмрд░реНрд╕ рдХрд╛ рдЗрд╕рдиреЗ рдХреНрдпреВрдм рдХреНрдпреВрдм рдЬреЛ рд╣реИ рд╡реЛ рд╡реЛ

play03:59

рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░ рд▓рд┐рдпрд╛ рд▓реЗрдХрд┐рди рдЕрдЧрд░ рдореИрдВ рдЗрд╕реА рдХреЛ

play04:02

рд▓рд┐рд╕реНрдЯ рдХреЙрдореНрдкреНрд░рд┐рдВрдЯ рд╕реЗ рд▓рд┐рдЦреВрдВ рдпреЗ рджреЗрдЦреЛ рд▓рд┐рд╕реНрдЯ

play04:05

рдХрдВрдкреНрд░рд┐рд╣реЗрдВрд╕рд┐рд╡ рд╕реЗрдо рдЪреАрдЬ рдЗрдЬреА рдореЗрдердб рд╣реИ рдореИрдВ

play04:08

рд╕рд┐рдВрдкрд▓ рдПрдХ рдЗрдЬреА рдирд╛рдо рдХрд╛ рдпрд╣рд╛рдВ рдкреЗ рдЬреЛ рд╣реИ рд╡реЛ

play04:10

рд▓рд┐рд╕реНрдЯ рдХреНрд░рд┐рдПрдЯ рдХрд░ рд░рд╣рд╛ рд╣реВрдВ x рдХрд░рдирд╛ рдХреНрдпрд╛ рд╣реИ

play04:13

рдЬреИрд╕рд╛ рдореИрдВрдиреЗ рдкрд╣рд▓реЗ рдмрддрд╛рдпрд╛ рдХрд░рдирд╛ рдХреНрдпрд╛ рд╣реИ x

play04:16

рдХреНрдпреВрдм рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░рдирд╛ рд╣реИ рддреЛ x рдпреЗ рдПрдХреНрд╕рдкреЛ

play04:18

рдПрд╕рд╢рди рдЬреЛ рд╣реИ рд╡реЛ рдпрд╣рд╛рдВ рдкреЗ рдпреВрдЬрд╝ рд╣реЛрддрд╛ рд╣реИ рддреЛ

play04:20

рдПрдХреНрд╕рдкреЛ рдПрд╕рд╢рди 3 рдлреЙрд░ x рдХрд┐рд╕рдХреЗ рд▓рд┐рдП рд╣рд░ рдПрдХ

play04:22

рд╡реИрд▓реНрдпреВ x рдХреЗ рд▓рд┐рдП рдЗрди рд░реЗрдВрдЬ рдпрд╣рд╛рдВ рдкреЗ рд╡рд╣реА рджреЗ

play04:25

рджрд┐рдП рдХрд┐ рдХрд╣рд╛рдВ рдкреЗ рд░реЗрдВрдЬ 10 рддрдХ рдЗрдл x рдкрд░ 2 рдЗрдЬ

play04:29

рдбрдмрд▓ = 0 рдорддрд▓рдм рд╣рдордиреЗ рдПрдХ рд╣реА рдПрдХреНрд╕рдкреНрд░реЗрд╢рди рдореЗрдВ

play04:33

рд╕рд╛рд░реА рдЪреАрдЬреЗрдВ рдореЗрдВрд╢рди рдХрд░ рджреА рдХрд┐ рд╣рд░ рдПрдХ рд╡реИрд▓реНрдпреВ

play04:35

рдХрд╛ рд░реЗрдВрдЬ рдореЗрдВ рдХреНрдпреВрдм рд░реВрдЯ рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░реЛ

play04:38

рд▓реЗрдХрд┐рди рдЬрд╣рд╛рдВ рдкреЗ рд╡реИрд▓реНрдпреВ рдЬреЛ рд╣реИ рд╡реЛ рд░рд┐рдорд╛рдЗрдВрдбрд░

play04:40

рдбрдмрд▓ рдЗрдХреНрд╡рд▓ рдЯреВ 0 рд╣реИ рдорддрд▓рдм рдЬрд╣рд╛рдВ рдкреЗ рдЗрд╡рди рдирдВрдмрд░

play04:43

рд╣реИ рдЙрдирдХрд╛ рдЬреЛ рд╣реИ рд╡реЛ q рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░реЛ рдФрд░

play04:44

рдкреНрд░рд┐рдВрдЯ рдХрд░рд╡рд╛ рджрд┐рдпрд╛ рдореИрдВрдиреЗ рддреЛ рджреЗрдЦ рд▓реЛ рдЬреА

play04:46

рджреЛрдиреЛрдВ рдХреА рдЖрдЙрдЯрдкреБрдЯ рдЬреЛ рд╣реИ рд╡реЛ рдмрд┐рд▓реНрдХреБрд▓ рд╕реЗрдо рдЖ

play04:49

рд░рд╣реА рд╣реИ рд▓реЗрдХрд┐рди рдпрд╣рд╛рдВ рдкреЗ рд▓рд╛рдЗрди рдСрдл рдХреЛрдб 1 2 3 4

play04:53

5 рдпрд╣рд╛рдВ рдкреЗ рд╕рд┐рд░реНрдл рд╡рди рдФрд░ рдЯреВ рдпрд╛рдиреА рдЖрдк рдпреЗ рдХрд╣

play04:56

рд╕рдХрддреЗ рд╣реЛ рдПрдлрд┐рд╢рд┐рдПрдВрд╕реА рдЕрдЧрд░ рдЖрдкрдХреЛ рдмреЛрд▓ рджреЗ рддреЛ рдЖрдк

play04:58

рдПрдлрд┐рд╢рд┐рдПрдВрд╕реА рдлреЙрд░реНрдореВрд▓реЗ рд╕реЗ рднреА рдХреИрд▓рдХреБрд▓реЗрдЯ рдХрд░ рд░рд╣реЗ

play05:00

рд╣реЛ рд╡реИрд╕реЗ рддреЛ рдЖрдкрдХреЛ рджрд┐рдЦ рд╣реА рд░рд╣рд╛ рд╣реИ рдпрд╣рд╛рдВ рдкреЗ

play05:02

рдХреНрдпрд╛ рдлрд╛рд░реНрдореВрд▓рд╛ рдкрд╣рд▓реЗ рдХрд┐рддрдиреА рдереА рд▓рд╛рдЗрдВрд╕ рдлрд╛рдЗрд╡

play05:05

рдЕрдм рдХрд┐рддрдиреА рд░рд╣ рдЧрдИ рдиреНрдпреВ рдЖрдИ рдерд┐рдВрдХ рдХрд┐рддрдиреА рд░рд╣ рдЧрдИ

play05:08

рдЯреВ рд░рд╣ рдЧрдИ рдирд╛ рдбрд┐рд╡рд╛рдЗрдб рдмрд╛рдп рдУрд▓реНрдб рдХрд┐рддрдиреА рдереА 5 *

play05:11

100 рддреЛ рдпреЗ рдЖрдк рдкрд░рд╕реЗрдВрдЯреЗрдЬ рдЬреЛ рд╣реИ рд╡реЛ

play05:13

рдЗрдВрдкреНрд░реВрд╡рдореЗрдВрдЯ рднреА рдлрд╛рдЗрдВрдб рдЖрдЙрдЯ рдХрд░ рд╕рдХрддреЗ рд╣реЛ рддреЛ

play05:15

рдЗрдВрдкреНрд░реВрд╡рдореЗрдВрдЯ рдХрд┐рддрдиреА рдЖрдИ 3 / 5 * 100 рдЬрд┐рд╕рдХреЛ

play05:18

рдЖрдк рдХреНрдпрд╛ рд▓рд┐рдЦ рд╕рдХрддреЗ рд╣реЛ 60 рдкрд░ рддреЛ 60 рдкрд░ рдЬреЛ рд╣реИ

play05:22

рд╡реЛ рдЗрдВрдкреНрд░реВрд╡рдореЗрдВрдЯ рдЖ рдЧрдИ рд╣реИ рдХреЛрдб рдореЗрдВ рдЬрдм рдЖрдк рдпрд╣

play05:25

рдореЗрдердб рдЬреЛ рд╣реИ рд╡реЛ рдЕрдкреНрд▓рд╛рдИ рдХрд░рддреЗ рд╣реЛ рд▓рд┐рд╕реНрдЯ

play05:27

рдХрдВрдкреНрд░реАрд╣реЗрдВрд╢рди рдХрд╛ рддреЛ рдпреЗ рд╕рд┐рдВрдкрд▓ рд╕рд╛ рдлрдВрдб рд╣реИ рдЖрдк

play05:29

рдЗрд╕рдХреЛ рдпрд╛рдж рд░рдЦрдирд╛ рдХрд╣реАрдВ рдкрд░ рднреА рдкреВрдЫрддреЗ рд╣реИрдВ

play05:31

рдЗрдВрдЯрд░рд╡реНрдпреВрдЬ рдореЗрдВ рдпрд╛ рдХреЙрд▓реЗрдЬ рдпреВрдирд┐рд╡рд░реНрд╕рд┐рдЯреА

play05:32

рдПрдЧреНрдЬрд╛рдо рдореЗрдВ рддреЛ рдЖрдк рдЗрдЬрд▓реА рдЖрдВрд╕рд░ рджреЗ рд╕рдХрддреЗ рд╣реЛ

play05:34

рдереИрдВрдХ рдпреВ

Rate This
тШЕ
тШЕ
тШЕ
тШЕ
тШЕ

5.0 / 5 (0 votes)

Related Tags
Python CodingList ComprehensionCode EfficiencyPerformance BoostCoding TechniquesEducational VideoCode OptimizationProgramming TipsCode CompressionPython Tutorial