Sequence data part 3

NPTEL-NOC IITM
7 Feb 202019:39

Summary

TLDRThe video script is a comprehensive tutorial on Python's sequence data operations. It covers slicing techniques for lists, strings, tuples, and bytes, explaining how to extract elements using start, stop, and step indices. The tutorial also explores concatenation and multiplication of sequences, emphasizing the distinction between mutable and immutable data types. It concludes with practical examples of applying these operations to manipulate and analyze sequence data effectively.

Takeaways

  • 😀 The lecture introduces the concept of slicing in sequence data, emphasizing its utility in accessing and manipulating parts of a sequence.
  • 🔍 Slicing in Python uses the syntax `sequence[start:stop:step]`, where `start`, `stop`, and `step` are optional parameters defining the slice's beginning, end, and increment, respectively.
  • ✂️ The slice object is created without modifying the original sequence, allowing for efficient data handling and extraction of subsequences or elements.
  • 🔢 Default values for slicing are `start=0`, `stop=end of sequence`, and `step=1`, which means the slice includes elements from the beginning to the end, one by one.
  • 🔄 Negative indices in slicing refer to positions from the end of the sequence, with `-1` being the last element.
  • 📝 For non-sequential data like dictionaries, slicing is not applicable as it requires an ordered data type to function.
  • 🔄 Slicing can be performed on lists, tuples, and strings, allowing for the extraction of sublists, sub-tuples, and substrings respectively.
  • 🔢 The lecture demonstrates how slicing can be used to perform operations like string repetition and list multiplication using the `*` operator.
  • 📚 Examples are provided to illustrate the practical application of slicing, such as extracting specific parts of a string or list based on given indices and conditions.
  • 💡 The importance of understanding slicing is highlighted for efficient data manipulation, especially when dealing with loops and large datasets.

Q & A

  • What is the primary topic discussed in the script?

    -The primary topic discussed in the script is the concept of slicing in sequence data, including strings, lists, tuples, and bytes, along with their applications in Python programming.

  • What does the term 'slicing' refer to in the context of the script?

    -In the context of the script, 'slicing' refers to the operation of extracting a portion of a sequence by specifying a range using start, stop, and step indices.

  • What are the three parameters typically used in a slice operation?

    -The three parameters used in a slice operation are the start index, the stop index, and the step value, which determine the beginning, end, and interval of the elements to be sliced from a sequence.

  • How does the script demonstrate slicing a string?

    -The script demonstrates slicing a string by using the slice function with start and stop indices, and it shows how to obtain a substring from a given string using this method.

  • What is the default step value in a slice operation if not specified?

    -The default step value in a slice operation if not specified is 1, which means each element in the sequence is visited once in the slice.

  • Can you use negative indices in slicing, and what does it represent?

    -Yes, negative indices can be used in slicing, and they represent positions from the end of the sequence, with -1 being the last element.

  • How does the script handle the situation when the stop index in a slice operation is beyond the sequence length?

    -The script handles the situation by stopping the slice at the end of the sequence, not going beyond its length.

  • What is the purpose of the step value in slicing, and how does it affect the output?

    -The step value in slicing determines the interval between elements selected in the slice. A step value greater than 1 will result in selecting every nth element, where n is the step value.

  • How does the script explain the difference between a list and a tuple when it comes to slicing?

    -The script explains that both lists and tuples can be sliced in the same way, but lists are mutable, meaning the sliced list can be modified, while tuples are immutable, so the sliced tuple cannot be changed.

  • What is the significance of the sequence protocol mentioned in the script?

    -The sequence protocol mentioned in the script is significant because it allows objects to support operations that depend on indexing, such as slicing, by defining methods like `__len__` and `__getitem__`.

  • Can you provide an example from the script where slicing is used to create a new list from an existing one?

    -Yes, the script provides an example where slicing is used to create a new list from an existing one by specifying the start and stop indices within the square brackets of the list.

Outlines

00:00

🔡 Introduction to Sequence Data and Slicing

The speaker welcomes the audience to a lecture on sequence data, focusing on the manipulation of such data through various operations. They introduce the concept of slicing, which is a method to extract parts of a sequence. The slicing operation is performed using a slice object that can take different types of sequences like strings, tuples, bytes, lists, or even a sequence protocol supporting any object. The slice object is defined by a start, stop, and step, which dictate the range and interval of the elements selected from the sequence. The speaker explains how to use the slice object with different parameters to extract the desired elements from a sequence, including default values and how to handle negative indices.

05:01

🔧 Practical Demonstration of Slicing Operations

The speaker proceeds with a practical example to demonstrate slicing operations. They create a string 'strassampel' and use slicing to extract a substring 'learning' from it. The explanation covers how to use the slice function with start and stop values, including the use of step values to skip elements. The speaker also clarifies the output of the slicing operation, emphasizing how it stops before the stop index and how the step value affects the output. They also touch upon the concept of increment values and how to interpret them in the context of slicing.

10:02

📝 Exploring Slicing with Different Data Types

The speaker explores slicing with different data types, including sequences like strings and non-sequence data types like dictionaries. They explain that slicing can be applied to any iterable object that supports the sequence protocol. The speaker also discusses the limitations of slicing with non-sequence data like dictionaries and sets, explaining that these data types do not maintain order and hence slicing is not applicable in the traditional sense. They further illustrate how slicing can be used with lists and how it can be combined with other operations like loops for more complex data manipulation.

15:04

🔄 Combining and Manipulating Sequence Data

The speaker discusses how to combine and manipulate sequence data using operations like addition and multiplication. They provide examples of how to concatenate strings and lists, and how to repeat elements in a sequence using multiplication. The speaker also covers the potential errors that can occur when attempting to perform these operations on incompatible data types, such as adding a string to a list. They emphasize the importance of ensuring that the data types are compatible before performing such operations.

20:05

🔢 Advanced Operations on Sequence Data

In the final part of the lecture, the speaker delves into more advanced operations on sequence data, such as multiplication and exponentiation. They demonstrate how to repeat elements in a sequence multiple times and how to handle different data types when performing these operations. The speaker also provides examples of how to multiply elements in a list by a certain factor and how to update the original list accordingly. The lecture concludes with a summary of the various slicing and manipulation techniques discussed, along with a preview of upcoming topics that will cover more complex data structures and operations.

Mindmap

Keywords

💡Slicing

Slicing in the context of the video refers to the operation of extracting a portion of a sequence data type such as a string, list, or tuple. It is a fundamental concept in Python programming and is crucial for manipulating and accessing elements within these data structures. The script mentions slicing as a way to handle sequence data, showcasing how to use the slice function with start, stop, and step parameters to obtain a subset of the data.

💡Sequence Data

Sequence data types are central to the video's discussion. These include strings, lists, tuples, and bytes, which are ordered collections of items that can be accessed by an index. The script explains how slicing can be applied to sequence data, emphasizing the importance of understanding these data types for data manipulation and extraction in programming.

💡Start, Stop, and Step

These terms are parameters used in slicing operations to specify the range of elements to extract from a sequence. 'Start' indicates the beginning index, 'stop' is the ending index, and 'step' determines the interval between elements. The video script provides examples of how these parameters can be used to control the slicing process, which is essential for precise data extraction.

💡String Manipulation

String manipulation involves operations performed on strings to transform, extract, or combine them. The video script uses string manipulation as an example to illustrate slicing, showing how to create substrings from a given string using slicing techniques. This is a common task in programming, particularly when handling text data.

💡Increment Value

The increment value in slicing refers to the step parameter, which determines the interval between elements in the sliced sequence. The script explains that by default, the increment value is 1, meaning each element is selected. However, it can be adjusted to skip elements or select them more frequently, which is demonstrated with examples in the video.

💡List Comprehension

List comprehension is a concise way to create lists in Python. The video script touches upon list comprehension as an alternative to slicing when specific elements or conditions are required. It is a powerful feature for creating new lists by applying an expression to each item in a sequence and is used for its efficiency and readability.

💡Non-sequential Data

Non-sequential data, such as dictionaries and sets, do not maintain the order of elements. The script points out that slicing, which relies on order, cannot be directly applied to non-sequential data types. This distinction is important for understanding the limitations of slicing and the need for different approaches when working with unordered data structures.

💡Concatenation

Concatenation is the process of joining two or more sequences together. In the video script, concatenation is discussed as a way to combine strings or lists. It is a common operation in programming, used to merge data from different sources, and the script provides examples of how to concatenate different data types.

💡Data Operations

Data operations encompass a range of actions performed on data, such as addition, multiplication, and other transformations. The video script covers data operations like concatenation and multiplication (repeating elements) on sequences, demonstrating how these operations can be used to manipulate and process data effectively.

💡Indexing

Indexing is the method of accessing elements in a sequence by their position. The script explains how indexing works in Python, using both positive and negative indices to access elements from the start or end of a sequence. Understanding indexing is fundamental to slicing and other data manipulation techniques in programming.

💡Data Structures

Data structures are specialized formats for organizing, processing, and storing data. The video script discusses various Python data structures like lists, tuples, and sets, highlighting their properties and how they can be manipulated using slicing and other operations. Data structures are crucial for efficient data management in programming.

Highlights

Introduction to sequence data and operations that can be performed on it.

Explanation of the slice operation and its usage in accessing elements of a sequence.

The role of start, stop, and step in the slicing operation.

How to use the slice function with different arguments for sequence data.

The concept of default increment value in slicing and how to specify it.

Demonstration of slicing a string to obtain a substring.

Use of slicing to extract elements from a sequence based on a specified range.

Explanation of how slicing works with negative indices and steps.

The impact of the increment value on the slicing operation.

How to perform slicing on lists to extract elements or sub-lists from a sequence.

Difference between using square brackets and colon operators for slicing.

The behavior of slicing when applied to dictionaries and sets.

Practical examples of using slicing to manipulate sequence data.

Discussion on the limitations of slicing with non-sequential data types.

Explanation of how to concatenate sequences using the plus operator.

Illustration of combining sequences using various data operations.

The concept of performing multiplication operations on sequence data.

How to use indexing and slicing to access and manipulate specific elements in a sequence.

Summary of the lecture's key points on handling sequential data operations.

Transcripts

play00:08

సీక్వెన్స్‌ డాటా పై ఉపన్యాసానికి

play00:11

అందరికీ స్వాగతం. మరియు ఈ ఉపన్యాసంలో

play00:16

మనం నిర్వహించగల కొన్ని కార్యకలాపాలను

play00:20

చూడబోతున్నాం ఒక క్రమం డేటా మీద. కాబట్టి,

play00:25

స్లైసింగ్తో ప్రారంభిద్దాం. కాబట్టి, ఇచ్చిన

play00:29

క్రమాన్ని ముక్కలు చేయడానికి స్లైస్

play00:33

ఆబ్జెక్ట్ ఉపయోగించబడుతుంది. మరియు క్రమం స్ట్రింగ్

play00:37

కావచ్చు, క్రమం స్ట్రింగ్ టపుల్స్, బైట్లు,

play00:42

జాబితా లేదా పరిధి కావచ్చు

play00:46

లేదా సీక్వెన్స్ ప్రోటోకాల్ కు మద్దతు

play00:50

ఇచ్చే ఏదైనా వస్తువు. మరియు స్లైస్ వస్తువు

play00:56

సూచికలను సూచిస్తుంది ప్రారంభ స్టాప్ మరియు

play01:01

దశ విలువ ఇచ్చిన శ్రేణి ఫంక్షన్ ద్వారా

play01:06

పేర్కొనబడింది. స్లైస్ ఆపరేషన్ యొక్క స్లైస్

play01:11

ఆబ్జెక్ట్ యొక్క వాక్యనిర్మాణం ఇక్కడ

play01:15

ఇవ్వబడింది మరియు వాక్యనిర్మాణం స్లైస్

play01:18

ఫంక్షన్ కోసం ఇక్కడ ఇవ్వబడింది. కాబట్టి,

play01:23

మీరు స్లైస్ ఆఫ్ స్టాప్ను ఉపయోగించవచ్చు

play01:28

లేదా మీరు స్లైస్ ఆఫ్ స్టార్ట్ స్టాప్

play01:33

అండ్ స్టెప్ను ఉపయోగించవచ్చు. కాబట్టి,

play01:37

ప్రాథమికంగా స్లైస్ ఫంక్షన్ రెండింటిలోనూ

play01:41

ఒకే అర్ధాన్ని కలిగి ఉన్న మూడు వాదనలను

play01:46

తీసుకుంటుంది. కాబట్టి, మొదటిది ప్రారంభం,

play01:50

ఇది ప్రారంభ పూర్ణాంక విలువ, ఇక్కడ స్ట్రింగ్

play01:56

అనేది ఒక పూర్ణాంక విలువ, ఇది ప్రారంభాన్ని

play02:01

సూచించే పూర్ణాంక విలువ ఎక్కడ నుండి

play02:06

ఐతే ఆబ్జెక్ట్స్‌ స్లైసింగ్‌ మొదలు

play02:10

అవుతుందో కాబట్టి, మొదటి వాదన ప్రారంభం.

play02:14

కాబట్టి, అది స్లైసింగ్ ఉన్న ప్రారంభ పూర్ణాంకం

play02:20

వస్తువు యొక్క ప్రారంభం తదుపరిది పైన ఉంటుంది,

play02:26

ఇది ముక్కలు చేసే వరకు ఒక పూర్ణాంకం

play02:31

స్థలం. కాబట్టి స్లైసింగ్ ఇండెక్స్ n మైనస్

play02:36

1 లేదా మైనస్ 1 వద్ద ఆగిపోతుంది. కాబట్టి,

play02:39

ఉదాహరణకు I రెండవ వాదనను 4 గా ఇచ్చాము

play02:44

అంటే అది స్టాప్ విలువ. కాబట్టి, ఇది

play02:49

వెళుతుంది నాకు ఇప్పటికీ 3 విలువల క్రమాన్ని

play02:53

ఇవ్వండి. కాబట్టి, తదుపరిది ఒక పూర్ణాంక

play02:57

విలువను నిర్ణయించే దశ. స్లైసింగ్ కోసం

play03:01

ప్రతి సూచిక మధ్య పెరుగుదల.

play03:04

కాబట్టి, ఉదాహరణకు మీరు 2 ఇస్తుంటే, మీరు

play03:09

పొందుతారు, కాబట్టి, మీరు పొందుతారు దశ

play03:13

పరిమాణం 2 లో విలువలు. కాబట్టి, డిఫాల్ట్గా

play03:18

మీరు ఏమీ ఇవ్వకపోతే అది చేయబోతోంది దానిని

play03:23

ఇంక్రిమెంట్ విలువగా 1 గా తీసుకోండి, కానీ

play03:27

మీరు ఏదైనా విలువను అందిస్తున్నట్లయితే

play03:30

అది కొనసాగుతుంది. దానిని ఇంక్రిమెంట్

play03:34

విలువగా పరిగణించండి. కాబట్టి, ఈ ఉదాహరణతో

play03:38

ప్రారంభిద్దాం స్ట్రింగ్. కాబట్టి, మనము ఇప్పటికే

play03:41

స్ట్రాసాంపిల్ అనే స్ట్రింగ్ను సృష్టించాము,

play03:45

దీనికి స్ట్రింగ్ ఉంది నేర్చుకోవడం.

play03:48

కాబట్టి, ఇప్పుడు నా లక్ష్యం ఇచ్చిన

play03:52

స్ట్రింగ్ స్ట్రాసంపుల్ నుండి సబ్స్ట్రింగ్ను

play03:55

పొందడం.

play03:56

ఇచ్చిన స్ట్రింగ్ ఇచ్చిన స్ట్రింగ్

play03:59

లెర్నింగ్ నుండి నేర్చుకుంటుంది.

play04:01

కాబట్టి, అలా చేయడానికి మనం స్లైస్ వస్తువును

play04:06

ఉపయోగించవచ్చు. కాబట్టి, స్ట్రాసంపుల్ లో

play04:09

నేను I యొక్క స్లైస్ ని ఉపయోగిస్తున్నాను

play04:14

స్క్వేర్ బ్రాకెట్ల లోపల స్లైస్ ఫంక్షన్ను

play04:19

ఉపయోగిస్తున్నాను, తరువాత స్లైస్ ఫంక్షన్

play04:23

లోపల I నేను కేవలం మూడు విలువలను ఇస్తున్నాను,

play04:30

ఒకటి స్టార్ట్ స్టాప్ మరియు స్టెప్ విలువ.

play04:35

కాబట్టి, ఇక్కడ అవుట్పుట్ నేను ఇప్పటికే ఎర్

play04:41

అని ముద్రించాను, ఇది నేర్చుకోవడం

play04:45

నుండి ఇ మరియు ఆర్. కాబట్టి, ప్రాథమికంగా

play04:51

మనకు ఉంది ప్రారంభ సూచికను ఒకటిగా పేర్కొనడం

play04:56

ద్వారా అది వచ్చింది. కాబట్టి, వాస్తవానికి

play05:01

స్లైసింగ్ నుండి ప్రారంభమైంది e మరియు

play05:05

ఇది వాస్తవానికి ఇండెక్స్ 4 వద్ద ముగుస్తుంది,

play05:10

అప్పుడు ఇది 2,3 మరియు 4 అవుతుంది. కాబట్టి,

play05:16

n కి ఇండెక్స్ 4 ఉంటుంది, కానీ వాస్తవానికి

play05:21

ఇది మీకు n మైనస్ 1 వరకు ఇస్తుంది. కాబట్టి,

play05:35

ఇది r వద్ద ఆగిపోతుంది మరియు నేను ఇంక్రిమెంట్

play05:41

విలువను 2 గా ఇచ్చినందున అది జరగదు. మీకు e

play05:47

నుండి తీగల క్రమం యొక్క అన్ని క్రమాన్ని

play05:51

ఇస్తుంది, ఎందుకంటే ఇది మీకు ఇవ్వదు

play05:54

స్ట్రింగ్స్ యొక్క క్రమం e a r గా కాకుండా

play05:59

ఇది మీకు పరంగా క్రమాన్ని ఇవ్వబోతోంది

play06:01

తీగలను రెండు పెంచడం ద్వారా . కాబట్టి,

play06:03

ఇది మీకు r గా మాత్రమే ఇవ్వబోతోంది. కాబట్టి,

play06:07

ఇది మీకు అవుట్పుట్ను e r గా మాత్రమే ఇవ్వబోతోంది.

play06:13

కాబట్టి, ఈ విధంగా స్లైసింగ్ ఆపరేటర్.

play06:19

కాబట్టి, ఇచ్చిన క్రమాన్ని ముక్కలు

play06:23

చేయడానికి మనం స్లైస్ ఫంక్షన్ను ఈ విధంగా

play06:29

ఉపయోగిస్తాము. ఇచ్చిన స్ట్రింగ్ లేదా ఏదైనా

play06:34

సీక్వెన్స్ నుండి ఎలిమెంట్స్ లేదా

play06:39

సబ్స్ట్రింగ్ల ఇచ్చిన సీక్వెన్స్ వస్తువు.

play06:43

మరియు ఇతర పద్ధతి ఎలిమెంట్స్ లేదా

play06:48

సబ్స్ట్రింగ్లను ముక్కలు చేయడానికి

play06:51

ఇతర పద్ధతి. ఇచ్చిన వస్తువు నుండి చదరపు

play06:58

బ్రాకెట్ను ఉపయోగిస్తున్నారు. మీరు స్లైస్ ఫంక్షన్ను

play07:03

ఉపయోగించాల్సిన అవసరం లేదు.

play07:06

దాని లోపల మీరు స్లైస్ ఫంక్షన్ లేదా కోలన్

play07:13

ఆపరేటర్ను ఉపయోగించవచ్చు. ఇక్కడ నేను చదరపు

play07:19

బ్రాకెట్ లోపల ఒక కోలన్ను మాత్రమే

play07:24

ఉపయోగిస్తున్నాను. కాబట్టి, అది నాకు

play07:28

అన్ని సబ్స్ట్రింగ్లను ఇస్తుంది నేర్చుకునే

play07:32

స్ట్రింగ్ లెర్నింగ్ నుండి. కాబట్టి, కేవలం

play07:37

పెద్దప్రేగును ఉంచడం ద్వారా ఇవ్వడం ద్వారా

play07:43

చదరపు బ్రాకెట్ల లోపల నాకు పూర్తి

play07:48

తీగల సమితి అయిన అభ్యాసాన్ని తెస్తుంది

play07:53

ప్రధాన స్ట్రింగ్ నుండి ఇది స్ట్రాసాంపుల్.

play07:58

కాబట్టి, ఈ విధంగా మేము ముక్కలు చేస్తాము

play08:05

స్ట్రింగ్ క్రమం డేటా. కాబట్టి, ప్రాథమికంగా

play08:10

మనం ఏదైనా ఆపరేషన్లు చేయాలనుకున్నప్పుడల్లా

play08:14

స్లైసింగ్ను ఉపయోగిస్తాము. మీ స్ట్రింగ్లోని

play08:18

ఒక నిర్దిష్ట మూలకాల సమూహంపై లేదా మీ

play08:25

దేనిపైనా లేదా దానిని క్రమం డేటా పైనా

play08:31

వర్తింపజేయవచ్చు కాబట్టి, జాబితా

play08:34

నుండి అన్ని విలువలు మీ గణన ఆధారంగా లేదా

play08:41

ఆధారంగా సవరించబడవు. మీ ఆపరేషన్లో నిర్దిష్ట

play08:47

మూలకాలు లేదా సబ్స్ట్రింగ్లు మాత్రమే సవరించబడతాయి.

play08:52

మీరు దానిపై నిర్వహిస్తున్న కార్యకలాపాల ఆధారంగా.

play08:57

అదేవిధంగా మనం స్లైసింగ్ చేయవచ్చు

play09:01

ఏదైనా ఇతర సీక్వెన్స్ డేటాలో ఆపరేషన్లు

play09:07

ఉదాహరణకు వివరించడానికి తదుపరి ఉదాహరణ మీరు

play09:12

జాబితాలో ఉన్నారు. కాబట్టి, స్లైసింగ్

play09:16

చేసేటప్పుడు జాబితాలు ప్రాథమికంగా డిఫాల్ట్

play09:20

కార్యాచరణను కలిగి ఉంటాయి. కాబట్టి,

play09:24

ఇక్కడ జాబితా నమూనా క్రింద ఉన్న వాటిని

play09:31

ప్రింట్ చేద్దాం, కాబట్టి ఇవి ఈ విలువలు

play09:37

మొదటి నమూనా 1 2 a సామ్ మరియు 2 క్రింద ఉన్న

play09:47

మూలకాలు. కాబట్టి, ఇప్పుడు నేను ప్రదర్శన

play09:53

ఇవ్వబోతున్నాను జాబితా నమూనాలో కత్తిరించడం.

play09:57

కాబట్టి, ప్రాథమికంగా మొదటి పెద్దప్రేగుకు

play10:01

ముందు వాల్యూమ్ లేకపోతే ఉదాహరణకు ఇలా నేను

play10:08

మొదటి పెద్దప్రేగుకు ముందు ఎటువంటి విలువను

play10:14

ఇవ్వలేదు మరియు నేను ఇచ్చాను

play10:18

పెద్దకోలన్‌ తర్వాత విలువ ఆ సందర్భంలో

play10:24

అది జాబితా యొక్క ప్రారంభ సూచిక నుండి

play10:31

ప్రారంభించాలి. దీని అర్థం జాబితా యొక్క

play10:36

ప్రారంభ సూచిక వద్ద ముక్కలు చేయడం ప్రారంభించడం.

play10:43

కాబట్టి, ఏమిటో చూద్దాం మనం కోలన్ 3ని ఉపయోగించినప్పుడు

play10:51

ఇది జరుగుతుంది. కాబట్టి, అవుట్పుట్

play10:55

ఇక్కడ ఇవ్వబడింది. కాబట్టి, ఈ స్లైసింగ్

play11:01

ప్రారంభమైంది సూచిక 1 నుండి. కాబట్టి,

play11:07

స్లైసింగ్ జాబితా ప్రారంభం నుండి ప్రారంభమైంది

play11:12

1 మరియు తదుపరి విలువ స్టాప్ విలువ. కాబట్టి,

play11:20

0 1 2 3 ఇది మీకు సబ్ ఇవ్వబోతోంది.

play11:29

జాబితా నుండి సామ్ వరకు లేదా అంతకు

play11:36

ముందు ఉన్న అంశాలు. కాబట్టి, మనకు అవుట్పుట్

play11:43

1 2 మరియు a గా వచ్చింది. ఇండెక్స్ స్టాప్

play11:50

ఇండెక్స్ 3 వద్ద ఉన్నందున ఇది మీకు విలువను

play11:57

ఇవ్వబోతోంది ఇది మీకు మూలకాల క్రమాన్ని

play12:02

లేదా ఉప మూలకాల క్రమాన్ని ఇవ్వబోతోంది మూడవ

play12:08

సూచికకు సరిగ్గా ముందు ఉన్న మీ ప్రధాన

play12:14

జాబితా అంటే 1 2 మరియు a. మరో విషయం ఏమిటంటే

play12:23

ఇక్కడ గమనించండి, మీరు మొదటి కోలన్

play12:28

తర్వాత ఈ విధంగా విలువను అందించకపోతే,

play12:33

దాని అర్థం సూచిక 2 నుండి ప్రారంభించి

play12:39

జాబితా ముగింపు వరకు వెళ్ళడానికి. కాబట్టి,

play12:44

నేను కేవలం చెప్తున్నాను

play12:47

సూచిక 2 నుండి ప్రారంభించి, జాబితా ముగింపు వరకు

play12:54

వెళ్ళడానికి మరియు ప్రాథమికంగా ఈ సమయాన్ని

play12:59

ఆదా చేస్తుంది. కాబట్టి, ప్రాథమికంగా a యొక్క

play13:03

పొడవును మనం మాన్యువల్గా పేర్కొనవలసిన అవసరం

play13:05

లేదు. కాబట్టి, ఇది ఆదా చేస్తుంది మాకు

play13:07

సమయం. కాబట్టి, మనము లెన్ యొక్క లెన్

play13:08

యొక్క పొడవును మానవీయంగా పేర్కొనవలసిన అవసరం

play13:10

లేదు అది జాబితా ముగింపు అని పేర్కొనడం

play13:12

లేదా పేర్కొనడం లేదా పేర్కొనడం జాబితాలో

play13:13

ఎన్ని అంశాలు ఉన్నాయో తనిఖీ చేయండి. కాబట్టి,

play13:15

దానిని వదిలించుకోవడానికి మీరు కేవలం మొదటి

play13:16

నిలువు వరుస తర్వాత మీరు ఏమీ పేర్కొనాల్సిన

play13:18

అవసరం లేదు. తద్వారా, ఇది మీ జాబితా ముగింపు

play13:20

వరకు అన్ని ఉప అంశాలను స్వయంచాలకంగా తీసుకుంటుంది.

play13:22

కాబట్టి, ఈ

play13:23

జాబితాలోని స్లైసింగ్ ఆపరేషన్ను మనం ఎలా

play13:24

నిర్వహిస్తాము. కాబట్టి, ఇక్కడ మీరు గమనించినట్లయితే

play13:25

నేను స్లైస్ ఫంక్షన్ను ఉపయోగించలేదు, బదులుగా

play13:27

నేను కలిగి ఉన్నాను కేవలం ఇవ్వడం ద్వారా

play13:28

వేరు చేయడం ద్వారా జాబితా నుండి ఉప

play13:30

మూలకాలను ముక్కలు చేయడానికి కోలన్

play13:31

ఆపరేటర్ను ఉపయోగించారు కోలన్ ఆపరేటర్ను

play13:32

ఉపయోగించే విషయంలో ప్రారంభ స్టాప్ మరియు

play13:34

దశ విలువ. మరియు మీరు గుర్తుంచుకోగలిగితే

play13:35

స్లైస్ ఫంక్షన్ లోపల స్లైస్ ఎంపిక లోపల

play13:37

మీరు ఇక్కడ ఇచ్చే ఏ ఆర్డర్ అయినా ఇక్కడ

play13:39

ఇవ్వండి

play13:40

అదే ఇక్కడ వర్తిస్తుంది కానీ స్లైస్ ఫంక్షన్ను

play13:41

ఉపయోగించే బదులు నేను స్క్వేర్ను

play13:42

బ్రాకెట్‌ ను ఉపయోగించాను. మరియు నేను 2 కోలన్

play13:44

3 కోలన్ 1 ఇస్తే, ప్రారంభ సూచిక ప్రారంభమవుతుందని

play13:46

అర్థం 2 మరియు ముగింపు సూచిక 3 మరియు ఇంక్రిమెంట్

play13:48

విలువ 1 కానీ మీరు లేకుండా కూడా పేర్కొనవచ్చు

play13:50

నాకు 2 నుండి అన్ని విలువలు అవసరమని

play13:52

మరియు నాకు అన్నీ అవసరమని సూచించడానికి

play13:54

ఏదైనా విలువను ఇవ్వడం కూడా విలువలు 3 వరకు

play13:56

ఉంటాయి. ఉదాహరణకు ఇది ప్రారంభ విలువ

play13:57

మరియు స్టాప్ విలువ అవుట్పుట్ ఏమిటో

play13:58

తనిఖీ చేద్దాం? కాబట్టి, స్లైసింగ్ ఆపరేషన్

play14:00

జాబితా యొక్క సూచిక 2 నుండి జరుగుతుంది,

play14:02

ఇది 0 1 2 నుండి

play14:03

a అనేది 4 3 మరియు 4 వరకు ఉంటుంది మరియు ఇది

play14:04

4ని సూచికగా పరిగణించదు కానీ అది కేవలం పరిగణించబడుతుంది

play14:05

n మైనస్ 1 వరకు. కాబట్టి, అది 3 అవుతుంది. కాబట్టి,

play14:06

ఇది మీకు అవుట్పుట్గా a మరియు సామ్ ఇవ్వబోతోంది.

play14:07

కాబట్టి, ఇది స్పష్టంగా ఉందని నేను ఆశిస్తున్నాను.

play14:10

కాబట్టి, మరొక వైపు వరుస డేటా స్లైసింగ్

play14:14

చేయడానికి వెళ్దాం . కాబట్టి, మనము ఒక

play14:17

నిఘంటువు నమూనాను కూడా సృష్టించాము,

play14:19

కాబట్టి దానిపై స్లైసింగ్ చేద్దాం. కానీ ఇది

play14:23

మీకు టైప్ ఎర్రర్ మరియు హాషబుల్ టైప్

play14:26

అంటే స్లైస్ అని చెప్పడంలో ఎర్రర్

play14:29

ఇస్తుంది. కాబట్టి, మీరు

play14:31

పైథాన్ నిఘంటువు వస్తువును గుర్తుకు

play14:33

తెచ్చుకోవచ్చు, ఇది కీలక విలువ సూచిక

play14:36

సౌకర్యం మరియు విలువలను అందిస్తుంది నిఘంటువులో

play14:39

కీల ద్వారా ఇండెక్స్ చేయబడతాయి మరియు

play14:42

ఆ సందర్భంలో అవి ఏ క్రమంలో ఉంచబడవు

play14:45

ఇచ్చిన క్రమాన్ని స్లైస్ చేయడానికి

play14:48

ఇండెక్స్ అవసరం కాబట్టి మనం స్లైసింగ్ చేయలేము

play14:51

విలువలు లేదా మూలకాల ఇచ్చిన క్రమం. మీ

play14:54

నిఘంటువు నుండి విలువల క్రమం లేదా కీల క్రమాన్ని

play14:59

ముక్కలు చేయడానికి, స్లైస్ చేయండి. కాబట్టి,

play15:01

మనము నిఘంటువులో స్లైసింగ్ చేయలేము

play15:04

ఎందుకంటే ఇది ఒక కంటైనర్ కాదు ఇది

play15:07

నాన్ సీక్వెన్షియల్ డేటాను కలిగి ఉండటానికి

play15:10

ఒక కంటైనర్ కాదు. కాబట్టి, ఆ సందర్భంలో

play15:14

మనం చేయలేము దానిని ఒక సెట్లో కూడా వర్తింపజేయడానికి.

play15:18

కాబట్టి, మనం దానిని ఒక సెట్ మీద వర్తింపజేసినప్పుడు

play15:22

ఏమి జరుగుతుందో చూద్దాం.

play15:23

. కాబట్టి, సెట్ ఆబ్జెక్ట్ సబ్స్క్రిప్టబుల్

play15:26

కాదని చెప్పడంలో కూడా ఇది ఎర్రర్

play15:29

విసురుతుంది. సెట్ అనేది నాన్-సీక్వెన్షియల్

play15:31

డేటాను కలిగి ఉండటానికి కూడా ఒక కంటైనర్

play15:34

అని మనకు తెలుసు. కాబట్టి, అన్ని అంశాలు

play15:38

సమితి లోపల సూచిక చేయబడవు లేదా ఏ సూచికల

play15:42

ద్వారా సూచిక చేయబడవు, బదులుగా అవి కాదు

play15:46

ఏ క్రమంలోనూ నిర్వహించబడలేదు. కాబట్టి, మనం సెట్లో

play15:49

కూడా స్లైసింగ్ ఆపరేషన్ చేయలేము ఎందుకంటే

play15:52

ఈవెన్ సెట్ అనేది నాన్-సీక్వెన్షియల్

play15:54

డేటాను పట్టుకోడానికి కూడా ఒక కంటైనర్,

play15:57

ఆ సందర్భంలో అన్ని ఎలిమెంట్స్ సెట్

play16:00

లోపల ప్రతి మూలకానికి సంబంధించిన సూచిక

play16:03

కోసం ఏ సూచిక ఉండదు. కాబట్టి, మేము ఇండెక్స్లో

play16:07

కూడా స్లైసింగ్ చేయవచ్చు. కాబట్టి, తదుపరిది

play16:10

శ్రేణిపై ముక్కలు చేయడం. కాబట్టి, మన

play16:13

వద్ద ఉన్నదాన్ని కింద ముద్రించుకుందాం.

play16:15

1 2 3 మరియు 4 విలువలను కలిగి ఉన్న శ్రేణి

play16:20

నమూనా. కాబట్టి, మీరు ప్రాథమికంగా యాక్సెస్

play16:23

చేయాలనుకుంటే లేదా మీరు మీ శ్రేణి లోపల

play16:27

విలువలను పొందాలనుకుంటే లేదా ముక్కలు చేయాలనుకుంటే,

play16:30

మీరు కేవలం ప్రదర్శించవచ్చు దానిపై అదే స్లైసింగ్

play16:33

ఆపరేషన్ నాకు కేవలం ఒక పెద్దకోలన్‌ ఇవ్వబడింది.

play16:37

కాబట్టి, అది నాకు ఇస్తుంది అవుట్పుట్

play16:39

మనకు మొదటి సూచిక నుండి 2,3 మరియు 4 అనే

play16:44

అన్ని విలువలను ఇస్తుంది ఎందుకంటే విలువ ఎందుకంటే

play16:48

విలువ 2 కి సంబంధించిన సూచిక 1. రివర్స్ ఇండెక్స్

play16:52

లేదా నేను యాక్సెస్ ఇచ్చిన నెగటివ్ ఇండెక్స్

play16:56

ఇవ్వడం ద్వారా కూడా మీరు దానిని స్లైస్

play16:59

చేయవచ్చు. సూచిక 1 మరియు ముగింపు సూచిక

play17:03

నుండి ప్రారంభమయ్యే విలువలు మైనస్ 1 గా

play17:06

ఉండాలి, అంటే

play17:07

మీ శ్రేణి యొక్క రెండవ చివరి మూలకం.

play17:11

కాబట్టి, అవుట్పుట్ ఏమిటో చూద్దాం? కాబట్టి,

play17:14

ఆ సందర్భంలో మీకు 2 మరియు 3 మాత్రమే

play17:18

ఉంటాయి ఎందుకంటే మీరు మొదటి మూలకాన్ని

play17:21

మినహాయించారు సూచిక 0 మరియు చివరి విలువకు

play17:24

మనము మైనస్ 1 ఇచ్చాము. అదేవిధంగా నేను శ్రేణి

play17:28

నమూనాను ఇచ్చినందున మీరు అదే మోనో శ్రేణిని

play17:32

కూడా ప్రదర్శించవచ్చు మరియు చదరపు బ్రాకెట్

play17:35

లోపల నేను కోలన్ మరియు మైనస్ 1 ఇచ్చాను.

play17:39

కాబట్టి, ప్రాథమికంగా మీరు పొందుతారు లేదా

play17:41

మీరు మొదటి నుండి అన్ని విలువలను ముక్కలు

play17:45

చేస్తారు కానీ మీరు చేయలేరు కానీ అప్పుడు

play17:48

మీరు మీ శ్రేణి యొక్క చివరి మూలకం యొక్క

play17:52

చివరి మూలకాన్ని మినహాయిస్తారు

play17:54

అప్పుడు అది మీకు 1,9,4 మాత్రమే ఇస్తుంది.

play17:58

కాబట్టి, ఇప్పుడు ప్రాథమికంగా సీక్వెన్షియల్

play18:00

డేటాపై స్లైసింగ్ ఆపరేషన్ ఎలా పని

play18:03

చేయాలో చూశాము ఇప్పుడు మనం కొన్ని అత్యంత

play18:06

ప్రాథమిక సీక్వెన్స్ డేటా ఆపరేషన్లను

play18:09

నేర్చుకుంటాము, అవి సంయోగం. మరియు గుణకారం.

play18:12

కాబట్టి, మీరు మీ లూపింగ్ ఓవర్ మీద

play18:15

లూప్ చేస్తున్నప్పుడు ఇది సహాయపడుతుంది.

play18:17

మీ కంటైనర్లలోని అంశాలు. కాబట్టి,

play18:20

ఇప్పుడు మనం కొన్ని అత్యంత ప్రాథమిక

play18:23

క్రమాన్ని నేర్చుకుంటాము. దీనికి వర్తింపజేయగల

play18:25

సంయోగం మరియు గుణకారం అయిన డేటా కార్యకలాపాలు

play18:28

ఏదైనా వరుస డేటా. కాబట్టి, మేము ప్లస్

play18:32

ఆపరేటర్ను ఉపయోగించి సంయోగం చేయబోతున్నాము.

play18:34

మరియు మీరు సాధించడానికి ప్రయత్నిస్తున్న

play18:37

దానిపై ఆధారపడి దీన్ని చేయడానికి కొన్ని

play18:39

మార్గాలు ఉన్నాయి మరియు బహుళ తీగలను

play18:42

జోడించడానికి ప్లస్ చిహ్నాన్ని ఉపయోగించడం

play18:45

సరళమైన మరియు అత్యంత సాధారణ పద్ధతి కలిసి

play18:48

లేదా బహుళ మూలకాలను కలిసి జోడించడానికి

play18:51

ఇది ఏదైనా వరుస డేటాపై వర్తించవచ్చు. అలాగే.

play18:55

మరియు కేవలం ఒక ప్లస్ ను ఎన్ని వాటి మధ్య

play18:59

ఉంచితే అంత వాటి మధ్య ఉంచండి మీరు

play19:03

కలిసి చేరాలనుకున్నట్లుగా తీగలు. కాబట్టి, అలా

play19:06

చేయడానికి ఒక ఉదాహరణ చూద్దాం. కాబట్టి,

play19:08

కోసం

play19:09

ఉదాహరణకు, కాబట్టి, స్ట్రాసాంపుల్ కింద

play19:11

ఏమి ఉందో మనకు తెలుసు, దీనికి కేవలం ఒక

play19:15

పద అభ్యాసం ఉంది. కాబట్టి, నేను ఇక్కడ

play19:19

ప్లస్ ఆపరేటర్ను ఉపయోగించి రెండు

play19:21

తీగలను కలపబోతున్నాను. కాబట్టి, నేను స్ట్రాసాంపుల్ను

play19:24

పైథాన్ అయిన మరొక స్ట్రింగ్తో కలపబోతున్నాను

play19:27

కానీ పైథాన్ I కి ముందు ఒకే కోట్ లోపల స్థలం

play19:28

ఇచ్చారు. కాబట్టి, ఇది నేర్చుకోవడం

play19:29

మధ్య ఖాళీని కలిగి ఉంటుంది. మరియు పైథాన్.

play19:30

కాబట్టి, అక్కడే స్థలం ఇవ్వబడింది.

play19:31

కాబట్టి, ఇది కేవలం చేరడానికి మాత్రమే.

play19:32

రెండు తీగలు కలిసి ఉంటాయి. కాబట్టి,

play19:33

అవుట్పుట్ చూద్దాం. కాబట్టి, మొదటి లైన్

play19:34

అవుట్పుట్ స్ట్రాసాంపిల్ ప్రింట్ మరియు తదుపరి

play19:35

వరుసలో నేను అది నవీకరించబడిందో

play19:36

లేదో తనిఖీ చేస్తున్నాను నేను ఇప్పటికే ఉన్న

play19:37

స్ట్రింగ్కు కొత్త స్ట్రింగ్ను జోడించాను

play19:38

లేదా జోడించాను కాబట్టి లేదా కాదు స్ట్రింగ్.

play19:39

కాబట్టి, నన్ను తనిఖీ చేయనివ్వండి. కాబట్టి,

play19:40

నేను స్ట్రాసాంపుల్ను ప్రింట్ చేసి, అక్కడ

play19:41

ఏమి ఉందో చూద్దాం కానీ దురదృష్టవశాత్తు

play19:42

ఇది పైథాన్లో మాత్రమే నేర్చుకోవడం అనేది

play19:43

ఇప్పటికే ఉన్న స్ట్రాసాంపిల్ కి నవీకరించబడదు

play19:44

అందుకే స్ట్రింగ్ గుర్తుంచుకోండి,

play19:45

ఎందుకంటే గుర్తుంచుకోండి స్ట్రింగ్ అనేది

play19:46

మార్పులేనిది మరియు మీరు వేరియబుల్లో

play19:47

నిల్వ చేసిన స్ట్రింగ్ను కలపడం లేదా పునరావృతం

play19:48

చేస్తే మీరు కేటాయించాల్సి ఉంటుంది దానిని ఉంచడానికి

play19:49

మరొక చరరాశికి కొత్త స్ట్రింగ్. కాబట్టి,

play19:50

మనం అలా చేద్దాం. కాబట్టి, ఏదైనా నేను

play19:51

ఇక్కడ నిర్వహిస్తున్న ఆపరేషన్ ను కొత్త

play19:52

చరరాశికి నవీకరిస్తున్నాను. కాబట్టి, అది నవీకరించబడుతుంది.

play19:53

కాబట్టి, ఇప్పుడు మీరు కొత్త స్ట్రింగ్ను

play19:54

ప్రింట్ చేస్తే, అందులో పేర్కొన్న

play19:55

విధంగా లెర్నింగ్, పైథాన్ ఉంటుంది.

play19:56

. కాబట్టి, ఈ విధంగా మనం స్ట్రింగ్పై

play19:57

సంయోగం చేస్తాము. కాబట్టి, ఇది ఎప్పుడు

play19:58

చాలా ఉపయోగకరంగా ఉంటుంది

play19:59

మీరు మీ డేటాలోని వస్తువుల గుండా లూప్

play20:00

చేస్తున్నప్పుడు మీరు ప్రదర్శిస్తున్నప్పుడు

play20:01

చేయాలనుకుంటున్నారు మరియు మీరు ఈ సంయోగం

play20:02

లేదా గుణకారం వంటి కొన్ని కార్యకలాపాలను

play20:03

చేయాలనుకుంటే ఇది చాలా ఉపయోగకరంగా

play20:04

ఉంటుంది. కాబట్టి, తరువాత జాబితాలోని

play20:05

సంయోగాన్ని చూద్దాం. కాబట్టి, ఇది మన వద్ద

play20:06

ఉన్న అసలు జాబితా 1 2 ఎ సామ్ 2 మరియు తదుపరి

play20:07

వరుసలో నేను కలుపుతున్నాను. ఇప్పటికే ఉన్న జాబితా

play20:08

lstsమ్పల్కు జాబితా మరియు జాబితాలో p

play20:09

y I అనే స్ట్రింగ్ ఉంటుంది దానిని చదరపు

play20:10

బ్రాకెట్ లోపల ఇవ్వండి ఎందుకంటే మీరు జాబితాకు

play20:11

అనుసంధానించగలుగుతారు. కాబట్టి,

play20:12

మీరు ఇక్కడ చూడగలిగితే, ఇప్పటికే ఉన్నదానికి

play20:13

ఒక మూలకంగా జోడించినట్లుగా పై జాబితా జోడించబడింది

play20:14

మొదటి ఉదాహరణగా ఉన్న జాబితా. కాబట్టి,

play20:15

పై స్ట్రింగ్ కలిగి ఉన్న ప్రత్యేక జాబితా

play20:16

మన వద్ద లేదు. బదులుగా అది జోడించబడింది

play20:17

లేదా అసలు జాబితాలోనే నవీకరించబడుతుంది

play20:18

లేదా నవీకరించబడుతుంది అసలు జాబితాలో చివరి

play20:19

మూలకం. మరియు శ్రేణులను ఎలా కలపవచ్చు అనేదానికి

play20:20

ఒక ఉదాహరణను చూద్దాం, మనం ఒక ఉదాహరణను

play20:21

చూద్దాం.

play20:22

రెండు వేర్వేరు సీక్వెన్స్ డేటాను కలపగలుగుతుంది,

play20:23

ఉదాహరణకు ఒక ఉదాహరణను ప్రయత్నిద్దాం. జాబితా

play20:24

మరియు శ్రేణులను కలిసి కలపడం. కాబట్టి,

play20:25

మొదట కింద ఏమి ఉందో చూద్దాం ఇది ప్రాథమికంగా

play20:26

ఒకటి రెండు మూడు మరియు నాలుగు విలువలను

play20:27

కలిగి ఉన్న శ్రేణి, ఇవి పూర్ణాంక డేటా

play20:28

రకానికి చెందినవి మరియు ప్లస్ ఆపరేటర్ను

play20:29

ఉపయోగించడం ద్వారా నేను కలిసి జాబితాను

play20:30

కలపబోతున్నాను ఇప్పటికే ఉన్న శ్రేణికి జాబితాను

play20:31

కలపండి. కాబట్టి, అది జరుగుతుందో లేదో

play20:32

చూద్దాం.

play20:33

కాబట్టి, ఇది ప్రాథమికంగా మీకు ఏ ట్రేస్ బ్యాక్

play20:34

ఎర్రర్లను విసురుతుంది, అది ప్రాథమికంగా

play20:35

మీకు టైప్ ఎర్రర్ను విసురుతుంది ఇది

play20:36

జాబితా చేయడానికి శ్రేణిని మాత్రమే

play20:37

జోడించగలదని చెబుతూ, అది శ్రేణికి జోడించలేము.

play20:38

కాబట్టి, రకం ఎర్రర్ అనేది ప్రాథమికంగా

play20:39

ఎగురవేయడం, ఇది శ్రేణికి మాత్రమే శ్రేణిని

play20:40

జోడించగలదని, శ్రేణికి జాబితా చేయలేదని

play20:41

చెబుతోంది. కాబట్టి, మనము సంయోగం చేయడానికి

play20:42

ప్రయత్నిస్తున్నందున లేదా జాబితాను జోడించడానికి

play20:43

ప్రయత్నిస్తున్నందున సాధ్యం కాని ప్రస్తుత

play20:44

శ్రేణి. కాబట్టి, మనం ఇక్కడ చేయవలసింది

play20:45

ఏమిటంటే మీరు సంయోగం చేయాలనుకుంటే ఒక

play20:46

శ్రేణికి. మీరు సీక్వెన్స్ డేటాను ఒక శ్రేణికి

play20:47

అనుసంధానించాలనుకుంటే, ఆ సీక్వెన్స్ డేటా

play20:48

ఉండాలి.

play20:49

శ్రేణిలో అదే రకంగా ఉండండి. కాబట్టి,

play20:50

మనం ఇక్కడ చేయగలిగేది ఏమిటంటే మనం అదే

play20:51

విలువలను ఉపయోగించవచ్చు. కానీ ప్రాథమికంగా

play20:52

అర్రే ఫంక్షన్ను ఉపయోగించి మరియు

play20:53

డేటా రకాన్ని ఉంచుతూ వాటిని అర్రేగా ఉంచండి

play20:54

పూర్ణాంకంగా మరియు విలువలను శ్రేణిగా

play20:55

ఇవ్వడం మరియు శ్రేణి లోపల జాబితాగా విలువలను

play20:56

ఇవ్వడం. అర్రే శాంపిల్ మీరు సృష్టించినప్పటి

play20:57

నుండి ఇచ్చిన విలువలు 50 మరియు 60 తో అనుసంధానించబడుతుంది.

play20:58

ఇది శ్రేణిగా మరియు తరువాత సంయోగం చేయబడింది.

play20:59

కాబట్టి, తదుపరిది రెండు టపుల్స్ను

play21:00

కలపడంపై సంయోగం. కాబట్టి, ఇక్కడ మీరు

play21:01

చూడగలిగితే

play21:02

ఇక్కడ నేను ప్లస్ మరియు సమానంగా ఉపయోగించాను,

play21:03

అంటే నేను కొత్త టుపుల్ను జోడించబోతున్నాను.

play21:04

ఇప్పటికే ఉన్న టుపుల్, టప్ శాంపిల్ మరియు

play21:05

అది ఆటోమేటిక్ గ్లూ మరియు దానిలో నవీకరించబడుతుంది

play21:06

టాప్సాంపిల్ స్వయంగా. కాబట్టి, టప్ శాంపిల్

play21:07

ప్రాథమికంగా 1,2,3,4 మరియు పై కలిగి ఉంది

play21:08

మరియు నేను th ని జోడించాను, విడిగా a గా ఆన్ చేసి,

play21:09

నేను రెండు తీగలను కలిగి ఉన్న కొత్త

play21:10

టుపుల్ను జోడించాను. కాబట్టి, మరియు అది

play21:11

జోడించబడుతుంది మరియు అది ఇప్పటికే

play21:12

ఉన్న టప్ శాంపిల్ కి జోడించబడుతుంది

play21:13

మరియు ఇది ఇప్పటికే ఉన్నటుపుల్ శాంపిల్

play21:14

పై నవీకరించబడుతుంది నేను ప్లస్ మరియు

play21:15

సమానంగా ఇచ్చినందున .

play21:16

తదుపరిది సెట్లో సంయోగం. కాబట్టి,

play21:17

ప్రాథమికంగా ఇక్కడ నేను ఇప్పటికే ఒక

play21:18

సెట్ శాంపిల్ కలిగి ఉన్నాను. ఇది 24 డేటా

play21:19

ఉదాహరణ మరియు 87.5 విలువలను సమితి విలువలుగా

play21:20

కలిగి ఉంది మరియు నేను సంయోగం చేస్తున్నాను

play21:21

ఇక్కడ. నేను సెట్ మరియు నిఘంటువు యొక్క

play21:22

కామా వేరు చేయబడిన అంశాలతో టుపుల్గా

play21:23

మార్చబోతున్నాను. కాబట్టి, నేను కేవలం

play21:24

కామాను ఉంచడం ద్వారా ఇప్పటికే ఉన్న సెట్

play21:25

శాంపిల్కు విలువను కలుపుతున్నాను. నమూనాను

play21:26

సెట్ చేసిన తర్వాత, ఆపై దానిని సెట్

play21:27

చేసిన నమూనాకు నవీకరించండి. కాబట్టి, ఆ విలువ

play21:28

నవీకరించబడుతుంది వాస్తవ సెట్ నమూనాలో.

play21:29

కాబట్టి, మీరు ఇక్కడ చూడగలిగితే నేను

play21:30

చాలాసార్లు పరుగెత్తాను. కాబట్టి, మీరు దానిని

play21:31

నడుపుతున్న ప్రతిసారీ అసలు సెట్ నమూనాలో

play21:32

దాన్ని నవీకరించబోతోంది. కాబట్టి, అదేవిధంగా

play21:33

మీరు చేయవచ్చు ఏదైనా వరుస డేటాపై గుణకారం

play21:34

అని పిలువబడే ఆపరేషన్, ఉదాహరణకు మీరు దీనిలో

play21:35

గుణించడం మీరు స్ట్రింగ్పై గుణకారాన్ని వర్తింపజేస్తుంటే,

play21:36

మీరు వెళ్తున్నారని అర్థం మీరు పునరావృతం

play21:37

చేయబోయే స్ట్రింగ్ను గుణించడానికి మీరు

play21:38

స్ట్రింగ్ సమితిని పునరావృతం చేయబోతున్నారు

play21:39

కేవలం ఒక సంఖ్యను ఇవ్వండి. మీకు తీగలను

play21:40

కలిగి ఉంటే మరియు మీకు తీగలను కలిగి

play21:41

ఉంటే దానిలో కొంత ఉంటే అర్థంలో గుణకారం

play21:42

మీరు దానిపై కొంత గుణకారం చేస్తున్నట్లయితే,

play21:43

మీరు గుణకారం చేస్తున్నట్లయితే దానిపై ఆపరేషన్ చేస్తే,

play21:44

అది మీరు ఎన్నిసార్లు చేశారో అంత సార్లు

play21:45

విలువలను పునరావృతం చేయబోతోంది. గుణకంగా

play21:46

ఇవ్వబడింది. కాబట్టి, ఏమి జరుగుతుందో చూద్దాం.

play21:47

కాబట్టి, నాకు ఇక్కడ ఒక ఉదాహరణ ఉంది నక్షత్రం

play21:48

3కి సమానంగా ఇవ్వబడింది. కాబట్టి, నాకు 3 కి

play21:49

సమానమైన స్ట్రాసంపుల్ నక్షత్రం ఉంది, అంటే

play21:50

నేను వెళ్తున్నాను. స్ట్రాసంపుల్ కింద

play21:51

ఉన్నదాన్ని పునరావృతం చేయడానికి, ఆపై నేను

play21:52

దానిని ఇప్పటికే ఉన్నదానికి నవీకరించబోతున్నాను

play21:53

ఎస్ఆర్ నమూనానే. కాబట్టి, మనం పరుగెత్తుదాం.

play21:54

కాబట్టి, నేర్చుకోవడం అంటే అక్కడ మరియు

play21:55

కింద ఉన్నది. కాబట్టి, నేర్చుకోవడం అనేది

play21:56

స్ట్రాసాంపుల్ కింద ఒక స్ట్రింగ్ నేను

play21:57

చెట్టు ఆస్టెరిక్స్ 3ని ఇచ్చాను, అది స్ట్రింగ్ను

play21:58

మూడుసార్లు పునరావృతం చేసింది మరియు దానిలో

play21:59

నవీకరించబడుతుంది స్ట్రాసాంపుల్ మరియు

play22:00

అందుకే స్ట్రాసాంపుల్ను ముద్రించేటప్పుడు

play22:01

మీకు అవుట్పుట్ లెర్నింగ్ గా వచ్చింది, నేర్చుకోవడం

play22:02

మరియు నేర్చుకోవడం. కానీ మీరు దానిని

play22:03

జాబితాలో ప్రదర్శించినప్పుడు ఏమి జరుగుతుంది,

play22:04

అది కూడా రెండింటినీ కలిగి ఉంటుంది. దానికి

play22:05

సంఖ్యలు మరియు తీగలను కానీ ఈ సందర్భంలో

play22:06

దానికి తీగలను కలిగి ఉన్నందున కానీ ఈ

play22:07

సందర్భంలో

play22:08

మీరు ఆస్టెరిక్స్ మరియు 2 ఇచ్చినందున

play22:09

ఇది మీ జాబితాలోని మూలకాన్ని రెండుసార్లు

play22:10

పునరావృతం చేయబోతోంది . మరియు మీరు ఒక నిర్దిష్ట

play22:11

మూలకాన్ని ఉపయోగించి వాటిని యాక్సెస్

play22:12

చేయడం ద్వారా ఎన్నిసార్లు పునరావృతం చేయవచ్చు

play22:13

సూచిక. కాబట్టి, ఇక్కడ నేను మొదటి సూచికకు

play22:14

సంబంధించిన విలువను రెండుసార్లు పునరావృతం

play22:15

చేయబోతున్నాను. అది 4 అయితే మీరు ఉదాహరణకు

play22:16

చేయగలరు కానీ మీరు జాబితా నమూనాను ప్రింట్

play22:17

చేసి చూడగలిగితే కానీ మీరు జాబితా

play22:18

నమూనాను ముద్రించి, విలువ రెండుసార్లు

play22:19

పునరావృతం కాలేదని చూడగలిగితే

play22:20

దానిని అక్కడ నవీకరించలేదు. కాబట్టి, మీరు ఇక్కడ

play22:21

చిహ్నానికి సమానంగా ఇచ్చి, ఆపై అమలు చేస్తే

play22:22

అది. కాబట్టి, ప్రాథమికంగా పైథాన్ స్పష్టమైన

play22:23

మార్పిడి చేయదు, ఉదాహరణకు మీరు ప్రదర్శిస్తున్నట్లయితే

play22:24

స్ట్రింగ్ ఉన్న ఒక ఆపరేషన్ అప్పుడు

play22:25

అది ఒక సంఖ్యను ఒక నిర్దిష్ట సంఖ్యకు

play22:26

గుణించదు దానికి ఇచ్చిన విలువతో ఒక

play22:27

సంఖ్యను గుణించడం లేదు, బదులుగా అది

play22:28

పునరావృతం చేయబోతోంది మీరు ఎన్ని సార్లు

play22:29

ఇచ్చారో దానికి విలువలు. కానీ మీరు యాక్సెస్

play22:30

చేయడానికి ప్రయత్నిస్తున్నట్లయితే

play22:31

ఒక నిర్దిష్ట విలువ, ఇది పూర్ణాంకం, ఆపై

play22:32

మీరు గుణన చర్యను నిర్వహిస్తున్నారు

play22:33

దానిపై మరియు ఆ సందర్భంలో అది ఇచ్చిన దానికి

play22:34

ఎన్ని సార్లు ఆ నిర్దిష్ట విలువను గుణించబోతోంది

play22:35

. ఇక్కడ ఒక ఉదాహరణను చూద్దాం, మనకు మొదటి

play22:36

సూచికకు అనుగుణంగా 2 విలువ ఉంది. మరియు

play22:37

నేను దానిని 2 విలువతో గుణించడానికి ప్రయత్నిస్తున్నాను

play22:38

మరియు దానిని నవీకరించడానికి కూడా ప్రయత్నిస్తున్నాను.

play22:39

ఆ సందర్భంలో అసలు జాబితా నాకు 8 అని

play22:40

అవుట్పుట్ ఇవ్వబోతోంది. కాబట్టి, ఇప్పుడు

play22:41

అవుట్పుట్ ఎలా ఉంటుందో చూద్దాం. కాబట్టి,

play22:42

ఈ సందర్భంలో మొదట మీకు 1,2, ఒక సామ్ మరియు

play22:43

2 ఉన్నాయి.

play22:44

మరియు నేను 2 కి సమానమైన 1 ఆస్టెరిక్స్ యొక్క

play22:45

lst శాంపిల్ ఇచ్చినందున ఆ నిర్దిష్ట విలువ

play22:46

ఉంది ఇచ్చిన విలువ 2 తో గుణించబడుతుంది.

play22:47

కాబట్టి, 2 సార్లు 2 మీకు 4 అనే విలువను

play22:48

ఇస్తుంది మరియు అది మీ అసలు జాబితాలో

play22:49

తేదీ అవుతుంది. కాబట్టి, మీరు ఒక పూర్ణాంకం

play22:50

మీద గుణకారం ఆపరేషన్ చేస్తున్నప్పుడు

play22:51

ఇదే జరుగుతుంది లేదా ఒక ఫ్లోట్ కానీ మీకు

play22:52

ఏదైనా స్ట్రింగ్ విలువ ఉంటే మరియు

play22:53

మీరు కొన్నింటిని నిర్వహించడానికి

play22:54

ప్రయత్నిస్తున్నట్లయితే

play22:55

దానిపై గుణకార ఆపరేషన్ ఉదాహరణకు మనకు రైట్

play22:56

అని పిలువబడే విలువ ఉంది. కాబట్టి, 0 1 2,

play22:57

2 అనేది దానికి సంబంధించిన సూచిక. కాబట్టి, ఏమి

play22:58

జరుగుతుందో ప్రయత్నిద్దాం. కాబట్టి, ఇది వెళుతోంది

play22:59

నేను ఇచ్చినప్పటి నుండి మీరు ఇక్కడ

play23:00

ఎన్నిసార్లు ఇచ్చారో ఆ నిర్దిష్ట మూలకాన్ని

play23:01

పునరావృతం చేయడానికి 2 ఇచ్చిన విలువ రెండుసార్లు

play23:02

పునరావృతమవుతుంది. కాబట్టి, మీరు ఏ రకమైన

play23:03

సీక్వెన్షియల్ డేటాపై అయినా మల్టిప్లికేషన్

play23:04

ఆపరేషన్ చేసినప్పుడు ఇదే జరుగుతుంది మీకు

play23:05

అవును, నేను దిగువ గదిలో పునరావృతం

play23:06

చేసిన అదే ఉదాహరణ ఉంది. కాబట్టి, ఇది

play23:07

ఇప్పటికే రెట్టింపు అయ్యింది.

play23:08

a మరియు మీరు దానిని రెండవ సంఖ్యతో గుణించడానికి

play23:09

ప్రయత్నిస్తుంటే అది పునరావృతమవుతుంది.

play23:10

మళ్ళీ రెండుసార్లు. మీరు సంయోగం చేసినప్పుడు

play23:11

ఏమి జరుగుతుందో చూద్దాం. అవేమిటో చూద్దాం

play23:12

మీరు టుపుల్ మీద గుణకారం చేసినప్పుడు

play23:13

ఇది జరుగుతుంది. కాబట్టి, ప్రారంభంలో

play23:14

అది బేస్ కలిగి ఉంది. కాబట్టి, లెట్ టుపుల్

play23:15

నమూనాలో ఉన్నదాన్ని ప్రింట్ చేస్తాము.

play23:16

కాబట్టి, ఇక్కడ నేను చేస్తున్నది ఏమిటంటే.

play23:17

కాబట్టి, నేను ఇక్కడ చేస్తున్నది ఏమిటంటే,

play23:18

నేను ఒక నిర్దిష్ట భాగాన్ని ముక్కలు

play23:19

చేయబోతున్నాను.

play23:20

టుపుల్ నుండి మూలకాల సమితి మరియు తరువాత

play23:21

చేయటానికి వెళ్లి, ఆపై గుణకారం చేయండి

play23:22

ఆపరేషన్. కాబట్టి, దానికి ముందు టుపుల్

play23:23

నమూనాలో ఉన్నదాన్ని ప్రింట్ చేద్దాం.

play23:24

కాబట్టి, ఏమిటి? మీ టుపుల్ శాంపిల్ లిస్ట్

play23:25

1,2,3,4,3 మరియు పై లో ఉందా మరియు 2 కోలన్ 4 అనేది

play23:26

3 తప్ప మరొకటి కాదు మరియు 4. కాబట్టి,

play23:27

2 కోలన్ అనేది 2 కోలన్ 4 ముక్కలు, మూలకాలు

play23:28

3 మరియు 4 మరియు నేను చేయబోతున్నాను ఆ

play23:29

సందర్భంలో రెండుసార్లు గుణించండి, అది కేవలం

play23:30

వాటిని గుణించబోతోంది. ఆ నిర్దిష్ట మూలకాన్ని

play23:31

రెండుసార్లు పునరావృతం చేయండి మరియు తదుపరి

play23:32

విషయం గుణకారం చేయడం శ్రేణిలో.

play23:33

కాబట్టి, ఇది ప్రాథమికంగా గుణిస్తుంది, ఇది

play23:34

ప్రాథమికంగా ఇచ్చిన శ్రేణిని రెండుసార్లు

play23:35

పునరావృతం చేస్తుంది. నక్షత్రం 2 ఇవ్వబడింది.

play23:36

మరియు తదుపరిది శ్రేణి నమూనా, మనము శ్రేణి

play23:37

నమూనాను అది విసిరే రెండుతో గుణిస్తున్నాము.

play23:38

ఆస్టెరిక్ శ్రేణి కోసం టైప్ ఎర్రర్

play23:39

మరియు సపోర్ట్డ్ ఒపెరాండ్ టైప్ అని

play23:40

చెప్పడంలో లోపం ఉంది మరియు నేను అమర్చాను

play23:41

మరియు పూర్ణాంకంలో ఎందుకంటే మీరు a పై

play23:42

గుణకార చర్యను నిర్వహించలేరు పరిధి ఎందుకంటే పరిధిని

play23:43

ఉపయోగించి మీరు ఇచ్చిన విలువల క్రమాన్ని

play23:44

మాత్రమే సృష్టించగలరు

play23:45

పరిధి. మరియు మనము స్క్రిప్ట్ ముగింపుకు

play23:46

వచ్చాము మరియు ఈ ఉపన్యాసంలో మనం చూశాము

play23:47

ఈ ఉపన్యాసంలో మునుపటి ఉపన్యాసానికి కొనసాగింపుగా

play23:48

కొన్నింటిని ఎలా చేయాలో చూశాము. ఏదైనా

play23:49

సీక్వెన్షియల్ డేటాపై స్లైసింగ్ ఆపరేషన్ల

play23:50

గురించి. మరియు మనం కంటైనర్ మీద స్లైసింగ్

play23:51

చేసినప్పుడు ఏమి జరుగుతుందో కూడా

play23:52

చూశాము నాన్-సీక్వెన్షియల్ డేటాను కలిగి ఉండి,

play23:53

దాని తరువాత కొన్నింటిని ఎలా చేయాలో చూశాము

play23:54

ఏదైనా వరుస డేటాపై సంయోగం మరియు గుణకారం

play23:55

వంటి కార్యకలాపాలు. మరియు మేము కూడా

play23:56

చూశాము

play23:57

కొన్ని తనిఖీలు ఉదాహరణకు మనం రెండు సంఖ్యలను

play23:58

గుణించడానికి ప్రయత్నించినప్పుడు ఏమి జరుగుతుంది మరియు

play23:59

మేము స్ట్రింగ్ మీద గుణకారం చేసినప్పుడు

play24:00

జరుగుతుంది మరియు రాబోయే ఉపన్యాసాలలో

play24:01

మనం ఎక్కడ ఉంటామో సీక్వెన్స్ డేటా

play24:02

పద్ధతులను పరిశీలిస్తాము. వరుస డేటాతో మనం

play24:03

ఏమి చేయగలము మరియు కార్యకలాపాలు ఏమిటి

play24:04

అనే దానిపై ఎక్కువ దృష్టి పెట్టడం లేదా

play24:05

మీరు చేయగల పద్ధతులు ఏమిటి. కాబట్టి, రాబోయే

play24:06

ఉపన్యాసాలలో పద్ధతులు

play24:07

ఏదైనా కార్యకలాపాలను నిర్వహించడానికి

play24:08

వరుస డేటాను ఎలా ఉపయోగించవచ్చో చూద్దాము.

play24:09

కాబట్టి, మేము చుట్టడం. కాబట్టి, అవును, రాబోయే

play24:10

ఉపన్యాసాలలో మనం వరుస డేటా పద్ధతుల

play24:11

గురించి చూస్తాము. ఇది పద్ధతులు లేదా

play24:12

ఏదైనా వరుస డేటాను ఎలా వర్తింపజేయాలి

play24:13

అనేది తప్ప మరొకటి కాదు, ధన్యవాదాలు.

Rate This

5.0 / 5 (0 votes)

Related Tags
Python SlicingData OperationsSequential DataProgramming TutorialCode ExamplesString ManipulationList ComprehensionData StructuresPython TipsTutorial Series