Sequence_data_part_1

NPTEL-NOC IITM
12 Oct 202212:53

Summary

TLDRThe video script is a comprehensive tutorial on sequence data types in Python. It covers fundamental concepts like strings, lists, tuples, arrays, and sets, explaining their creation and manipulation. The script also delves into more complex data structures, demonstrating how to use functions like 'range' and 'dict' to generate sequences. It provides practical examples, such as creating a string with quotes and a list with numerical values, emphasizing the importance of sequence data types in Python programming.

Takeaways

  • 😀 The lecture introduces the concept of sequential data types in Python.
  • 📝 Sequential data types allow for the creation and manipulation of multiple values within a system.
  • 🔡 Examples of sequential data types include strings, Unicode strings, lists, tuples, and collections.
  • 💬 Strings in Python are ordered sequences of characters and can be created using single, double, or triple quotes.
  • 📚 Lists are created using square brackets and can contain items of different data types, including numbers and strings.
  • 🔑 Tuples are similar to lists but are immutable, meaning their contents cannot be changed after creation.
  • 🗃️ Sets and dictionaries are mentioned as non-sequential data types that store unique elements and key-value pairs respectively.
  • 🛠️ Arrays are discussed as a way to store collections of similar data types, often used for numerical data.
  • 🔄 The lecture demonstrates the creation and manipulation of strings, lists, and arrays with examples.
  • 🔍 The importance of understanding data types and their properties is emphasized for effective Python programming.

Q & A

  • What is the main topic of the lecture?

    -The main topic of the lecture is sequential data types in programming, specifically focusing on their usage and examples in Python.

  • What are the basic sequential data types discussed in the lecture?

    -The basic sequential data types discussed include strings, Unicode strings, lists, tuples, and collections such as arrays and object sequences.

  • How are strings defined in Python according to the lecture?

    -Strings in Python are defined as an ordered sequence of characters, which can include letters, numbers, and symbols, and can be enclosed in single, double, or triple quotes.

  • What is a list in Python?

    -A list in Python is a collection of items that are ordered and mutable, which means the items can be changed, and it can be defined using square brackets.

  • What is the difference between a list and a tuple in Python?

    -The main difference is that a list is mutable, meaning its contents can be changed, while a tuple is immutable, meaning its contents cannot be altered once created.

  • What is an array in Python?

    -An array in Python is a collection of objects stored in contiguous memory locations, and it is often used to store a collection of similar data types.

  • How are dictionaries created in Python?

    -Dictionaries in Python are created using curly braces, where keys are paired with values, and the key-value pairs are separated by commas.

  • What is a set in Python?

    -A set in Python is an unordered collection of distinct elements, which can be created using the set function or by placing elements within curly braces.

  • How can you create a range in Python?

    -A range in Python can be created using the range function, which takes parameters such as start, stop, and step values to generate a sequence of numbers.

  • What is the purpose of loops in Python when working with sequential data?

    -Loops in Python are used to iterate over sequential data types to perform operations on each element, and they are commonly used with structures like lists and tuples.

  • How can you print the elements of a list in Python?

    -The elements of a list in Python can be printed using a for loop, which iterates through each element and prints it, or by using the print function with the list as an argument.

Outlines

00:00

📘 Introduction to Sequential Data Types

The script begins with a welcome and an introduction to the topic of sequential data types in programming. It emphasizes the importance of understanding these data types for creating and managing multiple values within a system. The paragraph outlines the basic concept of sequential data types, which allow for the creation and manipulation of ordered collections, such as strings, Unicode strings, lists, tuples, and objects. The discussion also briefly touches on non-sequential data types like sets and dictionaries. The paragraph sets the stage for exploring examples of sequential data types, starting with strings.

05:00

🔡 Delving into String Data Type

This paragraph focuses on the string data type, explaining it as an ordered sequence of characters that can include letters, numbers, and symbols. It can be static or dynamic. The paragraph demonstrates how to define a string in Python using single, double, or triple quotes and how strings can be used to represent and store sequences of characters. An example is given where the string 'STAMP' is created and printed, showcasing the process of string creation and manipulation. The paragraph also explains that lists, another sequential data type, can be created using square brackets and can contain multiple data types, including strings and objects.

10:02

📐 Exploring Lists and Arrays

The script moves on to discuss lists and arrays as sequential data types. Lists are mutable and can contain elements of different data types, while arrays are fixed-size and typically hold elements of the same data type. The paragraph explains how to create lists and arrays in Python, emphasizing the use of square brackets for lists and the array module for arrays. It also touches on the concept of tuples as immutable sequences and the use of functions to create and manipulate these data structures. The paragraph concludes with a demonstration of how to print the values of a list, showcasing the use of a for loop to iterate through the list.

Mindmap

Keywords

💡Sequence Data

Sequence data refers to a type of data that is ordered and can have multiple values. In the context of the video, sequence data is fundamental as it allows for the creation and manipulation of various data structures like strings, lists, tuples, and arrays. The video discusses how sequence data can be used to store and manage ordered collections of items, which is essential for many programming tasks.

💡String

A string in the video is described as a sequence of characters that can include letters, numbers, and symbols. It can be immutable or mutable, meaning it can either change or remain constant. Strings are fundamental in programming as they are used to handle text data. The video gives an example of creating a string with single, double, or triple quotes and demonstrates how strings can be printed using the print function.

💡List

A list in the video is a sequence data type that is written with square brackets and allows for the storage of an ordered collection of items, which can be of different data types. Lists are mutable, meaning they can be changed after creation. The video explains how lists can be created and printed, and it also touches on the concept of nested lists, which are lists that contain other lists as elements.

💡Tuple

A tuple, as mentioned in the video, is another sequence data type similar to a list but is immutable, meaning its elements cannot be changed once it is created. Tuples are defined with parentheses and are used to store a collection of items that should not be altered. The video explains that tuples can be used to store a combination of different data types and can be printed to output their values.

💡Array

An array is a sequence data type that is used to store a collection of items of the same data type in contiguous memory locations. The video discusses how arrays can be created using the array module and how they are useful for storing and accessing large amounts of data efficiently. The concept is illustrated by showing how to create an array and iterate through its values using a for loop.

💡Dictionary

A dictionary in the video is described as an unordered collection of items stored as key-value pairs. It is a versatile data structure that allows for fast retrieval of values based on keys. The video explains how dictionaries can be created using curly braces or the dict function and how they can be used to store and manipulate data that is organized by keys. The video also demonstrates how to print a dictionary to view its keys and values.

💡Set

A set in the video is introduced as an unordered collection of unique elements. It is a data structure that does not allow duplicate values and is often used for membership testing and eliminating duplicate entries. The video explains how sets can be created using curly braces or the set function and how they can be printed to display their elements. Sets are also discussed in the context of performing mathematical set operations.

💡Range

The range in the video is a function that generates a sequence of numbers within a specified interval. It is commonly used for looping a specific number of times in a for loop. The video demonstrates how the range function can be used to create a sequence of numbers and how it can be utilized with other sequence data types to perform operations like printing a series of numbers.

💡Loop

A loop in the video refers to a programming structure that allows code to be executed repeatedly based on a given condition. The video discusses the use of loops, particularly for and while loops, to iterate over sequence data types like lists and arrays. Loops are essential for performing repetitive tasks and are illustrated in the video with examples of how to use them to print elements of a list or array.

💡Function

A function in the video is a block of organized, reusable code that is used to perform a single, related action. Functions are valuable for modular programming as they allow for the creation of reusable code blocks that can be called with specific parameters. The video explains how functions can be defined and called, and it demonstrates the use of built-in functions like print and range, as well as user-defined functions for specific tasks.

💡Data Type

Data types in the video are the categories or kinds of data that determine what kind of values a variable can store. The video discusses various data types such as strings, integers, and floats, and how they are used to define the nature of the data stored in variables. Understanding data types is crucial for proper data handling and manipulation in programming, and the video provides examples of how different data types are used in creating and using sequence data structures.

Highlights

Introduction to sequential data types in the lecture.

Explanation of sequential data types allowing the creation or storage of multiple values in a systematic manner.

Mention of various data types like strings, Unicode strings, lists, tuples, and object sequences.

Discussion on non-sequential data types such as numbers, sets, and containers.

Example of creating a string in Python and its mutable nature.

Demonstration of how to print strings using the print function.

Introduction to lists as a sequential data type in Python.

Explanation of lists allowing multiple data types and their mutable nature.

Example of creating a list with numbers and strings.

Introduction to arrays as a collection of elements stored in contiguous memory locations.

Explanation of how to create arrays using the array module in Python.

Discussion on tuples as another sequential data type in Python.

Explanation of tuples being immutable and their use cases.

Introduction to dictionaries as a collection of key-value pairs.

Explanation of how to create dictionaries using curly braces or the dict function.

Discussion on sets as an unordered collection of unique elements.

Explanation of how to create sets using the set function or curly braces.

Introduction to the range function as a way to generate a sequence of numbers.

Example of using the range function to create a sequence with a specific step.

Transcripts

play00:08

అందరికీ నమస్కారం, సీక్వెన్స్ డేటా

play00:11

రకంపై ఉపన్యాసానికి స్వాగతం.

play00:13

కాబట్టి, ఈ ఉపన్యాసంలో మనం సీక్వెన్స్ డేటా

play00:17

రకంతో వ్యవహరించబోతున్నాం.

play00:19

కాబట్టి, దానిలోకి ప్రవేశించే ముందు

play00:22

సీక్వెన్స్ డేటా రకాలు ఏమిటో ప్రారంభిద్దాం.

play00:26

ప్రాథమికంగా సీక్వెన్స్ డేటా రకం వ్యవస్థీకృత

play00:30

వ్యవస్థలో బహుళ విలువలను సృష్టించడానికి

play00:33

లేదా నిల్వ చేయడానికి మిమ్మల్ని అనుమతిస్తుంది.

play00:36

మరియు సమర్థవంతమైన శైలి.

play00:39

కాబట్టి అనేక క్రమాలు ఉన్నాయి, ఉదాహరణకు

play00:43

స్ట్రింగ్‌, యూనికోడ్ స్ట్రింగ్స్‌ , జాబితాలు,

play00:46

టపుల్స్ శ్రేణులు.

play00:47

మరియు వస్తువుల శ్రేణి.

play00:49

ఇతర రెండు డేటా రకాలను నిఘంటువులు మరియు

play00:54

సెట్లు లేదా కంటైనర్లు అని పిలుస్తారు నాన్

play00:59

సీక్వెన్షియల్ డేటా.

play01:00

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

play01:05

నాన్ వరుస డేటా రకం కోసం ఉదాహరణలను చూడబోతున్నాము.

play01:10

మొదట స్ట్రింగ్ డేటా రకం ఏమిటో చూద్దాం.

play01:15

స్ట్రింగ్ అనేది ఒకటి లేదా అంతకంటే

play01:18

ఎక్కువ అక్షరాల క్రమం, ఉదాహరణకు, ఇది అక్షరాలు,

play01:23

సంఖ్యలను కలిగి ఉండవచ్చు.

play01:25

మరియు చిహ్నాలు మరియు అవి స్థిరంగా లేదా

play01:30

చరరాశిగా ఉండవచ్చు.

play01:31

మరియు స్ట్రింగ్స్‌ ప్రాథమికంగా పైథాన్లో

play01:34

మార్చగల క్రమం.

play01:36

కాబట్టి, స్ట్రింగ్ను రూపొందించడానికి

play01:38

మనం సింగిల్, డబుల్ లేదా ట్రిపుల్ కోట్స్

play01:43

లోపల అక్షరాల క్రమాన్ని మూసివేయవచ్చు.

play01:46

స్ట్రింగ్ను రూపొందించడానికి ఒక ఉదాహరణను చూద్దాం.

play01:50

క్రియేట్ స్ట్రింగ్లో సింగిల్, డబుల్ లేదా

play01:53

ట్రిపుల్ కోట్స్ లోపల అక్షరాల క్రమం

play01:57

ఉంటుంది.

play01:58

నేను ఎస్టీఆర్‌ శాంపిల్‌ అనే స్ట్రింగ్ను

play02:02

సృష్టిస్తున్నాను మరియు ఇది అక్షరాల

play02:05

క్రమాన్ని కలిగి ఉంటుంది నేర్చుకోవడం

play02:08

మరియు నిల్వ చేయడం అనే పదాన్ని ఎస్టీఆర్‌

play02:12

శాంపిల్‌ అని పిలువబడే రెండు చరరాశులపై

play02:16

వివరిస్తుంది.

play02:17

కాబట్టి అది ఒక స్ట్రింగ్ అవుతుంది.

play02:21

కాబట్టి మనం ప్రింట్ ఫంక్షన్కు కాల్ చేయడం

play02:25

ద్వారా స్ట్రింగ్‌ లను ప్రింట్ చేయవచ్చు.

play02:29

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

play02:32

ఎస్టీఆర్‌ శాంపిల్‌ అవుట్పుట్ కాల్ లెర్నింగ్ను

play02:36

పొందుతుంది.

play02:37

కాబట్టి ఎస్టీఆర్‌ శాంపిల్‌ ఇప్పుడు

play02:40

ఒక స్ట్రింగ్.

play02:41

కాబట్టి లిస్ట్ అని పిలువబడే తదుపరి

play02:45

సీక్వెన్స్ డేటాకు వెళ్దాం.

play02:47

కాబట్టి స్క్వేర్‌ బ్రాకెట్ల లోపల క్రమాన్ని

play02:51

ఉంచడం ద్వారా పైథాన్లోని జాబితాను సృష్టించవచ్చు.

play02:55

కాబట్టి, ఇక్కడ నేను లిస్నంబర్‌ అను ఒక

play03:00

ఒక లిస్ట్‌ సృష్టిస్తున్నాను మరియు అది సంఖ్యలను

play03:04

మాత్రమే కలిగి ఉంటుంది.

play03:06

మరియు మీరు ఈ జాబితాలోని ఈ ఉదాహరణను పరిశీలిస్తే,

play03:12

నాకు ప్రాథమికంగా పునరావృతమయ్యే ఒక

play03:15

మూలకం ఉంది.

play03:16

దీనికి నకిలీ విలువలు ఉన్నాయి.

play03:19

ఎందుకంటే జాబితాలో వాటి విభిన్న స్థానాలతో

play03:23

నకిలీ విలువలు ఉండవచ్చు మరియు అందువల్ల బహుళ

play03:28

విలువలు ఉండవచ్చు.

play03:29

ఈ విషయం లేదా నకిలీ విలువలను జాబితా

play03:34

సృష్టించే సమయంలో క్రమం వలె పంపవచ్చు

play03:38

స్వయంగా.

play03:39

కాబట్టి ఇక్కడ లిస్నంబర్ అనేది సంఖ్యలను మాత్రమే

play03:43

కలిగి ఉన్న లిస్సాంపుల్ మరియు దీనికి నకిలీ

play03:48

విలువలు కూడా ఉన్నాయి.

play03:50

దానికి.

play03:51

కాబట్టి జాబితాను ప్రింట్ చేసి అవుట్పుట్

play03:54

ఏమిటో చూద్దాం.

play03:56

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

play04:00

దీనికి విలువలు 1,2,3,3,4 మరియు 5 ఉన్నాయి, కానీ

play04:05

ఒక్కటే లిస్ట్‌ ఇంటిజర్స్ స్ట్రింగ్స్తో పాటు

play04:09

ఆబ్జెక్ట్ వంటి డేటా రకాలను కలిగి ఉండవచ్చు.

play04:13

కాబట్టి జాబితా బహుళ డేటా రకాల అంశాలను

play04:18

కలిగి ఉండవచ్చు మరియు జాబితా కూడా మార్చగలదు

play04:23

మరియు అందువల్ల అవి వాటిని సృష్టించిన

play04:26

తర్వాత కూడా మార్చవచ్చు.

play04:29

కాబట్టి ఇప్పుడు నేను మరొక జాబితా

play04:32

కాల్ లిస్ట్‌ , ఎల్యెస్టీ శాంపిల్‌ రూపొందిస్తున్నాను,

play04:36

ఇది సంఖ్యలు మరియు స్ట్రింగ్స్‌ రెండింటినీ

play04:40

కలిగి ఉంటుంది.

play04:42

కాబట్టి, ఉదాహరణకు 1,2, a, సామ్ మరియు అలాగే

play04:47

ఇక్కడ 2, ఒక ఎల్యెస్టీ శాంపిల్‌ బహుళ డేటా

play04:52

రకాలు ఉంటాయి.

play04:54

దానిని ప్రింట్ చేసి చూద్దాం.

play04:57

కాబట్టి జాబితాను ఉపయోగించడం వల్ల

play05:00

కలిగే ఒక ప్రయోజనం ఏమిటంటే ప్రాథమికంగా

play05:04

మీరు బహుళ డేటా రకానికి చెందిన అంశాలను కలిగి

play05:09

ఉండవచ్చు.

play05:10

కాబట్టి, తరువాత మనం అర్రే అనే మరొక

play05:14

సీక్వెన్స్ డేటా కాల్ని పరిశీలిస్తాము

play05:17

మరియు అర్రే అనేది ఏమీ కాదు.

play05:21

ఇది పక్కపక్కనే ఉన్న మెమరీ ప్రదేశాలలో

play05:25

నిల్వ చేయబడిన వస్తువుల సేకరణ.

play05:28

మరియు ఒకే డేటా రకానికి చెందిన బహుళ అంశాలను

play05:33

కలిసి నిల్వ చేయడానికి మనము శ్రేణిని ఉపయోగించవచ్చు

play05:38

మరియు శ్రేణి మాడ్యూల్ను దిగుమతి చేయడం ద్వారా

play05:42

పైథాన్లోని శ్రేణులను సృష్టించవచ్చు.

play05:45

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

play05:49

కాబట్టి అర్రే నుండి నేను దానిని ఆస్టెరిక్స్గా

play05:53

ముఖ్యమైనది నేను వాటిని కాల్ చేయకుండా

play05:57

కూడా అర్రే నుండి ఒక ఫంక్షన్ను మాత్రమే

play06:01

ఉపయోగించగలను.

play06:02

మరియు వాక్యనిర్మాణం లేదా మనం అర్రే ఫంక్షన్ను

play06:07

ఉపయోగించగల విధానం ఏమిటంటే మనం డేటా

play06:11

రకాన్ని పేర్కొనాలి.

play06:12

మరియు ఫంక్షన్ శ్రేణికి వాదనగా విలువ జాబితా.

play06:17

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

play06:21

ఎలా సృష్టించాలో చూద్దాం.

play06:23

పేర్కొన్న విధంగా మొదటి వాదనగా డేటా

play06:27

రకం మరియు విలువలను ఇచ్చిన రెండవ వాదన

play06:31

జాబితాగా మరియు ఆ అవుట్పుట్ను అర్రే

play06:35

శాంపిల్ అని పిలువబడే వస్తువుగా నిల్వ

play06:39

చేయండి.

play06:40

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

play06:43

ప్రింట్ చేసి చూద్దాం.

play06:46

కాబట్టి ఇక్కడ నేను అర్రే శాంపిల్ యొక్క

play06:50

విలువలను ముద్రించడానికి ఫర్‌ లూప్ ఉపయోగిస్తున్నాను.

play06:54

కాబట్టి, మీరు మీ శ్రేణి పేరు యొక్క

play06:59

ముద్రణను మాత్రమే ఉపయోగిస్తే, మీరు

play07:02

ముద్రణ ఫంక్షన్ను ఉపయోగిస్తే అది కేవలం

play07:05

మీరు ఇచ్చే అదే ఇన్పుట్ను మీకు ఇవ్వబోతున్నాను

play07:10

కానీ మీరు విలువలను ముద్రించాలనుకుంటే,

play07:13

అప్పుడు మీరు మీ శ్రేణి యొక్క విలువలను

play07:18

పొందడానికి ఫర్ లూప్ను ఉపయోగించవచ్చు.

play07:21

కాబట్టి, ప్రాథమికంగా మొదటి ఇట్రేషన్ లో

play07:24

మొదటి విలువను ప్రింట్ చేయబోతోంది మరియు

play07:28

లూప్ కోసం వెళుతుంది తదుపరి శీర్షిక వరకు.

play07:33

కాబట్టి ఇది మీ శ్రేణి నమూనాలోని అన్ని

play07:37

విలువలను ముద్రించబోతోంది.

play07:39

ఇప్పుడు మనకు విలువలు వచ్చాయి.

play07:42

కాబట్టి విలువలు 1,2,3 మరియు 4.

play07:46

కాబట్టి ఈ విధంగా మనము ఒక శ్రేణిని

play07:50

సృష్టిస్తాము.

play07:51

మీరు ఇప్పుడు సృష్టించిన శ్రేణి కేవలం ఒక

play07:56

డైమెన్షనల్ శ్రేణి అని మీరు ఇక్కడ చూడగలిగినట్లుగా,

play08:00

మేము చేస్తాము రాబోయే సెషన్లో బహుమితీయ

play08:04

శ్రేణిని ఎలా సృష్టించాలో లేదా ఎలా వ్యవహరించాలో

play08:09

చూడండి.

play08:10

కాబట్టి ఇక్కడ నేను ఇచ్చిన పూర్ణాంకాన్ని

play08:13

సూచించడానికి డేటా రకాన్ని పూర్ణాంకంగా

play08:16

పేర్కొంటాను, మీరు వివిధ డేటా రకాలతో

play08:20

శ్రేణిని సృష్టించాలనుకుంటే, అప్పుడు మీరు సంజ్ఞామానాన్ని

play08:24

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

play08:28

కాబట్టి ఇక్కడ క్రింద పేర్కొన్న డేటా రకాలను

play08:32

వివిధ రకాల శ్రేణిని రూపొందించడంలో ఉపయోగించవచ్చు.

play08:36

కాబట్టి, నేను పైథాన్ రకాన్ని సూచించడానికి

play08:40

ఇక్కడ కోట్ ఇచ్చాను మరియు కనీస బైట్ల

play08:44

సంఖ్య.

play08:45

ఉదాహరణకు, మీరు డేటా టైప్ ఫ్లోట్ తో ఒక

play08:50

శ్రేణిని సృష్టించాలనుకుంటే, అప్పుడు మీరు ఉపయోగించవచ్చు

play08:54

కోడ్ f. కాబట్టి, తదుపరిది టుపుల్కు వెళదాం

play08:57

, అది కూడా సీక్వెన్స్ డేటా రకంలో ఒకటి.

play08:59

పైథాన్లోని టుపుల్ ఒక జాబితాను పోలి

play09:01

ఉంటుంది, కానీ రెండింటి మధ్య వ్యత్యాసం ఏమిటంటే

play09:03

మనం టుపుల్ యొక్క మూలకాలను కేటాయించిన

play09:05

తర్వాత వాటిని మార్చలేము , అయితే జాబితాలో

play09:07

మూలకాలను మార్చవచ్చు పైథాన్లో పేరెంథెసిస్‌

play09:08

లోపల అన్ని మూలకాలను ఉంచడం ద్వారా సృష్టించబడిన

play09:10

టపుల్స్ కామాలతో వేరు చేయబడతాయి.

play09:12

మరియు నేను అన్ని విలువలు లేదా మూలకాలను

play09:14

కామాలతో వేరు చేస్తున్నాను.

play09:15

మరియు టుపుల్ ఎన్ని అంశాలనైనా కలిగి

play09:17

ఉండవచ్చు మరియు అవి వివిధ డేటా రకాలుగా

play09:19

ఉండవచ్చు మరియు ఇక్కడ నేను ఇప్పుడు సృష్టిస్తున్న

play09:21

టుపుల్కు పూర్ణాంకం మరియు స్ట్రింగ్

play09:23

ఉన్నాయి మరియు టుపుల్ కూడా చేయవచ్చు కుండలీకరణాన్ని

play09:25

కూడా ఉపయోగించకుండా సృష్టించవచ్చు మరియు

play09:26

దీనిని టుపుల్ ప్యాకింగ్ అంటారు.

play09:28

కాబట్టి ఇక్కడ మీకు చూపించడానికి నా

play09:30

దగ్గర ఒక ఉదాహరణ ఉంది.

play09:31

కాబట్టి ఇక్కడ నేను టుపుల్ సృష్టించడానికి

play09:33

కుండలీకరణాన్ని ఉపయోగించలేదు కానీ

play09:34

నాకు విలువలు మాత్రమే ఇవ్వబడ్డాయి కామాలతో

play09:36

వేరు చేయబడింది.

play09:37

కాబట్టి మీరు మీ టుపుల్ విలువ యొక్క

play09:39

విలువలను ముద్రిస్తే, అది ఇలా ఉంటుంది.

play09:41

కాబట్టి మేము టుపుల్ ప్యాకింగ్ అని పిలిచాము.

play09:43

కాబట్టి తదుపరిది నిఘంటువు యొక్క నిఘంటువు

play09:45

సృష్టి, దీని కోసం మనం ఇలా ఒక నిఘంటువును

play09:47

సృష్టించాము . నిఘంటువును ఎలా సృష్టించాలో

play09:49

చూసే ముందు నిఘంటువు అంటే ఏమిటో మీకు

play09:51

చెప్తాను.

play09:52

కాబట్టి పైథాన్లోని నిఘంటువు అనేది డేటా

play09:53

విలువల క్రమబద్ధీకరించని సేకరణ, ఇది డేటామ్యాప్

play09:55

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

play09:57

ఒక మూలకంలో ఒకే విలువలను మాత్రమే కలిగి ఉన్న

play09:59

ఇతర డేటా రకాల మాదిరిగా కాకుండా.

play10:01

నిఘంటువు కీలక విలువ జతలను కలిగి ఉంటుంది.

play10:03

కాబట్టి నిఘంటువు మరింత అనుకూలమైనదిగా

play10:05

చేయడానికి నిఘంటువులో అందించిన ముఖ్య విలువలు.

play10:07

కాబట్టి పైథాన్ నిఘంటువులో కర్లీ బ్రాకెట్స్‌

play10:08

లోపల మూలకాల క్రమాన్ని ఉంచడం ద్వారా సృష్టించవచ్చు.

play10:11

ఇలాంటి కలుపులు మరియు మీరు మీ కీ విలువ

play10:13

జతలను కామా మరియు నిఘంటువు ద్వారా

play10:15

వేరు చేయవచ్చు ఇది ఒక జత విలువలను కలిగి

play10:18

ఉంటుంది.

play10:19

ఉదాహరణకు ఇది ఒక జత విలువలు, ఒకటి

play10:20

కీ మరియు మరొకటి సంబంధిత జత మూలకం

play10:22

దాని ప్రధాన విలువ.

play10:24

కాబట్టి ఇక్కడ ఒకటి కీలకం మరియు ఇక్కడ

play10:26

కీలక విలువ మొదటిది మరియు నిఘంటువులోని

play10:28

విలువలు ఏదైనా డేటా రకం మరియు అలాగే

play10:30

నకిలీ చేయవచ్చు.

play10:31

కానీ మీరు ప్రత్యేకమైన కీలను మాత్రమే కలిగి

play10:33

ఉండవచ్చు, కానీ మీరు నకిలీ విలువలను కలిగి

play10:35

ఉండవచ్చు.

play10:36

కాబట్టి మనము నిఘంటువును ఎలా సృష్టిస్తాము

play10:37

కాబట్టి ఇప్పుడు నిఘంటువుగా నమూనాను

play10:39

నిర్దేశించండి.

play10:40

ఖాళీ నిఘంటువు అని డిక్ట్ ఉపయోగించి

play10:41

అంతర్నిర్మిత ఫంక్షన్ ద్వారా కూడా నిఘంటువును

play10:43

సృష్టించవచ్చు.

play10:44

గిరజాల కలుపుల లోపల మూలకాలను ఉంచడం ద్వారా

play10:45

సృష్టించవచ్చు.

play10:46

కానీ మీరు నిఘంటువును రూపొందించడానికి

play10:47

డిస్ట్ ఫంక్షన్ను కూడా ఉపయోగించవచ్చు.

play10:48

కాబట్టి ఇక్కడ నేను డిక్ట్ అంతర్నిర్మిత

play10:50

ఫంక్షన్ ఉపయోగించి అదే నిఘంటువులను

play10:52

సృష్టిస్తున్నాను.

play10:53

కాబట్టి నాకు టుపుల్గా కీలక విలువలు ఇవ్వబడ్డాయి.

play10:54

కాబట్టి, ప్రతి సెట్ కీలక విలువ జతలుగా

play10:56

ఎంపిక చేయబడుతుంది.

play10:57

మీరు డిక్ట్ను ప్రింట్ చేస్తే, మీరు నిఘంటువును

play10:59

ప్రింట్ చేస్తే, మీకు కీలు మరియు

play11:01

విలువలు లభిస్తాయి.

play11:02

సెట్ సీక్వెన్స్ రకం ప్రాథమికంగా

play11:03

సెట్లు కలిగి ఉండవచ్చు వివిధ అంశాలను కలిగి

play11:06

ఉండవచ్చు, ఆర్డర్ ఒక సమితిలోని మూలకాల

play11:07

సంఖ్య నిర్వచించబడలేదు.

play11:08

ఏదైనా మార్పులేని డేటా రకం సమితి యొక్క

play11:10

ఒక మూలకం కావచ్చు.

play11:12

కాబట్టి ఇక్కడ నేను స్ట్రింగ్, పూర్ణాంకాన్ని

play11:13

సెట్ యొక్క మూలకాలుగా ఉపయోగిస్తున్నాను,

play11:15

ఉదాహరణకు ఒక సంఖ్య స్ట్రింగ్ ఒక టూపుల్.

play11:17

ఇక్కడ నేను స్ట్రింగ్ మరియు సంఖ్యలను ఉపయోగిస్తున్నాను.

play11:19

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

play11:21

ఇక్కడ గమనించదగ్గ విషయం ఏమిటంటే జాబితా

play11:23

అనేది సమితి యొక్క మూలకం కాకూడదు.

play11:25

మేము నిఘంటువు కోసం ఇచ్చినట్లుగా మరియు

play11:27

నిఘంటువును రూపొందించడానికి మూలకాలను జాబితాగా

play11:28

పాస్ చేసాము, కానీ సమితిని సృష్టించడానికి

play11:30

అలా చేయలేము ఎందుకంటే ఇది సమితి యొక్క

play11:32

మూలకం కాదు.

play11:33

మరియు మరొకటి కూడా ఒక సమితి యొక్క మూలకం

play11:36

కాకపోవచ్చు.

play11:37

కాబట్టి మీరు ఒక సమితిని ఉపయోగించి

play11:38

ఒక సమితిని సృష్టించలేరు, మీరు దానిని ఒక మూలకంగా

play11:40

కలిగి ఉండలేరు.

play11:41

మీరు ఒక సమితిని దాని అన్ని మూలకాలను

play11:43

బ్రాకెట్లలో అర్థం చేసుకోవడం ద్వారా

play11:45

సరళంగా నిర్వచించవచ్చు.

play11:46

కాబట్టి మీరు ఒక సమితిని సృష్టించడానికి

play11:47

అదే గిరజాల బ్రాకెట్లను ఉపయోగించవచ్చు లేదా

play11:49

మీరు ఫంక్షన్ను కూడా ఉపయోగించవచ్చు దీనిని

play11:51

అంతర్నిర్మిత సెట్ అని పిలుస్తారు,

play11:53

కాబట్టి మీరు సెట్ను సృష్టించడానికి

play11:54

సెట్ ఫంక్షన్ను కూడా ఉపయోగించవచ్చు.

play11:56

కాబట్టి, ఫంక్షన్ల సమితిని ఉపయోగించి

play11:57

సృష్టించగల ఖాళీ సమితి మాత్రమే మినహాయింపు.

play11:59

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

play12:01

మీరు జాబితా, స్ట్రింగ్ లేదా టుపుల్ను పరామితిగా

play12:03

ఉపయోగించాలి.

play12:04

కాబట్టి ఇది దాని మూలకాలతో కూడిన సమితిని

play12:05

తిరిగి ఇస్తుంది.

play12:06

ఉదాహరణకు, నేను ఇక్కడ ఒక సమితిని సృష్టిస్తున్నాను.

play12:08

కాబట్టి మీరు దానిని ప్రింట్ చేస్తే సెట్

play12:11

వాస్తవానికి దాని ఎలిమెంట్లను కలిగి

play12:12

ఉంటుంది.

play12:13

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

play12:14

సెట్ను ఎలా సృష్టించారు.

play12:15

కాబట్టి మనం ఇక్కడ చూడగలిగే తదుపరి

play12:17

విషయం శ్రేణి, ఇది సీక్వెన్స్ డేటా

play12:19

రకం కూడా.

play12:20

పైథాన్ మరియు రేంజ్లో, ఇది పైథాన్ యొక్క

play12:22

అంతర్నిర్మిత ఫంక్షన్.

play12:23

కాబట్టి మీరు నిర్దిష్ట సమయం వరకు ఏదైనా

play12:25

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

play12:26

మరియు ఇది సాధారణంగా లూపింగ్ కోసం ఉపయోగించబడుతుంది,

play12:29

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

play12:31

జ్ఞానం ఉంటుంది.

play12:32

ఏ రకమైన పైథాన్ కోడింగ్తోనైనా వ్యవహరించడానికి.

play12:34

ప్రాథమికంగా శ్రేణి ఫంక్షన్ మూడు వాదనలను

play12:35

తీసుకుంటుంది.

play12:36

మొదటి వాదన అనేది పూర్ణాంకాల క్రమం

play12:38

నుండి ప్రారంభమయ్యే పూర్ణాంకాలతో ప్రారంభ

play12:39

విలువ వ్రాయాలి.

play12:40

తదుపరి విలువ స్టాప్ విలువ.

play12:41

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

play12:44

n మైనస్ 1 విలువ లభిస్తుంది.

play12:45

కాబట్టి మీరు 12 కి ముందు విలువను పొందుతారు,

play12:46

అంటే 11.

play12:47

చివరి వాదన మీరు ఒక పూర్ణాంకాన్ని

play12:48

ఇవ్వగల స్టాప్ విలువ, దీనికి ముందు క్రమం

play12:49

ఉంటుంది.

play12:50

పూర్ణాంకాలు వ్రాయబడాలి.

play12:51

కాబట్టి చూద్దాం.

play12:52

నేను 1,12,4 ఇస్తున్నాను.

play12:53

కాబట్టి నేను 1 నుండి 12 వరకు విలువ యొక్క

play12:54

క్రమాన్ని సృష్టించబోతున్నాను.

play12:55

నేను దశ పరిమాణం 4 ఇచ్చినందున మీరు

play12:56

అవుట్పుట్ను 0.5 మరియు 9 గా పొందుతారు.

play12:57

పరిధి ఎలా ఉంటుంది అంటే శ్రేణి ఫంక్షన్

play12:58

ఎలా పనిచేస్తుంది.

play12:59

కాబట్టి ఇక్కడ కూడా నేను పరిధి విలువలను

play13:00

ముద్రించడానికి లూప్ కోసం ఉపయోగిస్తున్నాను.

play13:01

మీరు విలువలను పొందడానికి ప్రింట్ ఫంక్షన్ను

play13:02

మాత్రమే ఉపయోగిస్తే, మీరు మీ విలువ యొక్క

play13:03

ఇన్పుట్ను పొందుతారు.

play13:04

కాబట్టి ఈ ఉపన్యాసంలో సీక్వెన్స్ డేటా

play13:05

రకాలు ఏమిటి, ఆపై మనం కొన్నింటిని

play13:06

కూడా చూశాము.

play13:07

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

play13:08

క్రమం డేటా రకం.

play13:09

వాటిలో కొన్ని స్ట్రింగ్స్‌ , టపుల్స్, జాబితాలు,

play13:10

శ్రేణులు, నిఘంటువు సెట్లు మరియు పరిధి

play13:11

మరియు మనకు కూడా ఉన్నాయి అన్ని క్రమం

play13:12

డేటా రకానికి వస్తువును ఎలా ప్రారంభించాలో

play13:13

ఎలా సృష్టించాలో చూశారు.

play13:14

రాబోయే ఉపన్యాసాలలో ప్రతిదానిపై కొన్ని

play13:15

కార్యకలాపాలను ఎలా నిర్వహించాలో చూద్దాం.

play13:16

ధన్యవాదాలు .

Rate This

5.0 / 5 (0 votes)

Étiquettes Connexes
PythonSequential DataData StructuresStringsListsTuplesSetsContainersProgramming
Besoin d'un résumé en anglais ?