Các kiểu dữ liệu trong Python Lớp 11 là gì?

Các kiểu dữ liệu được sử dụng để xác định loại dữ liệu mà một vị trí bộ nhớ có thể chứa và các thao tác liên quan để xử lý dữ liệu đó. Dữ liệu mà chúng ta xử lý trong các chương trình của mình có thể thuộc nhiều loại như ký tự, số nguyên, số thực, chuỗi, boolean, v.v. do đó các ngôn ngữ lập trình bao gồm Python cung cấp các cách thức và phương tiện để xử lý tất cả các loại dữ liệu khác nhau này thông qua các loại dữ liệu. Các kiểu dữ liệu xác định khả năng xử lý một loại dữ liệu cụ thể, chẳng hạn như không gian bộ nhớ được phân bổ để chứa một loại dữ liệu nhất định và phạm vi giá trị được hỗ trợ cho một loại dữ liệu nhất định, v.v.

Các kiểu dữ liệu là phân loại hoặc phân loại các mục dữ liệu. Nó đại diện cho loại giá trị cho biết những thao tác nào có thể được thực hiện trên một dữ liệu cụ thể. Vì mọi thứ đều là đối tượng trong lập trình Python, nên kiểu dữ liệu thực chất là các lớp và biến là thể hiện [đối tượng] của các lớp này

Sau đây là kiểu dữ liệu tiêu chuẩn hoặc tích hợp sẵn của Python

số

Trong Python, kiểu dữ liệu số đại diện cho dữ liệu có giá trị số. Giá trị số có thể là số nguyên, số thực hoặc thậm chí là số phức. Các giá trị này được định nghĩa là lớp

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
3,
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
4 và lớp
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
5 trong Python

  • Số nguyên - Giá trị này được biểu thị bằng lớp int. Nó chứa các số nguyên dương hoặc âm [không có phân số hoặc số thập phân]. Trong Python không có giới hạn về thời lượng một giá trị số nguyên có thể
  • Float – Giá trị này được đại diện bởi lớp float. Nó là một số thực với biểu diễn dấu phẩy động. Nó được chỉ định bởi một dấu thập phân. Theo tùy chọn, ký tự e hoặc E theo sau là số nguyên dương hoặc âm có thể được thêm vào để chỉ định ký hiệu khoa học
  • Số phức – Số phức được biểu diễn bằng lớp phức. Nó được chỉ định là [phần thực] + [phần ảo]j. Ví dụ – 2+3j

Lưu ý – Hàm

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
6 dùng để xác định kiểu của kiểu dữ liệu

Python3




String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
7

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
8

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
0
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
2

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______7_______5
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6_______7_______7_______7_______8

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
0_______7_______1
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
2

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______17_______5
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6_______7_______7
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
8

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
0_______7_______1
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
2
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
3
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
4

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______27_______7
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6_______7_______7
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
0

đầu ra

Type of a:  

Type of b:  

Type of c:  
Loại trình tự

Trong Python, chuỗi là tập hợp có thứ tự các kiểu dữ liệu giống hoặc khác nhau. Sequences cho phép lưu trữ nhiều giá trị một cách có tổ chức và hiệu quả. Có một số loại trình tự trong Python –

1] Chuỗi

Trong Python, Chuỗi là mảng byte đại diện cho các ký tự Unicode. Chuỗi là tập hợp của một hoặc nhiều ký tự được đặt trong một trích dẫn đơn, trích dẫn kép hoặc trích dẫn ba. Trong python không có kiểu dữ liệu ký tự, ký tự là một chuỗi có độ dài một. Nó được đại diện bởi lớp

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
1
 

Tạo chuỗi

Các chuỗi trong Python có thể được tạo bằng cách sử dụng dấu ngoặc đơn hoặc dấu ngoặc kép hoặc thậm chí là dấu ngoặc kép

Python3




Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
2

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
3

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
5

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
6

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
7_______7_______1
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
9

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______50_______2
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______50_______5

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
7

First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
8

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
7_______7_______1

1

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______59_______4
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______50_______5

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
7
Traceback [most recent call last]:
  File "/home/7e8862763fb66153d70824099d4f5fb7.py", line 8, in 
    print[type[true]]
NameError: name 'true' is not defined
1

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
7

Traceback [most recent call last]:
  File "/home/7e8862763fb66153d70824099d4f5fb7.py", line 8, in 
    print[type[true]]
NameError: name 'true' is not defined
4

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
7_______7_______1
Traceback [most recent call last]:
  File "/home/7e8862763fb66153d70824099d4f5fb7.py", line 8, in 
    print[type[true]]
NameError: name 'true' is not defined
7

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial blank Set: 
set[]

Set with the use of String: 
{'F', 'o', 'G', 's', 'r', 'k', 'e'}

Set with the use of List: 
{'Geeks', 'For'}

Set with the use of Mixed Values
{1, 2, 4, 6, 'Geeks', 'For'}
0
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______50_______5

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
7
Traceback [most recent call last]:
  File "/home/7e8862763fb66153d70824099d4f5fb7.py", line 8, in 
    print[type[true]]
NameError: name 'true' is not defined
1

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial blank Set: 
set[]

Set with the use of String: 
{'F', 'o', 'G', 's', 'r', 'k', 'e'}

Set with the use of List: 
{'Geeks', 'For'}

Set with the use of Mixed Values
{1, 2, 4, 6, 'Geeks', 'For'}
9

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
00

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
7_______7_______1
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
03

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
04____0_______05

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
04____0_______07

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______10
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______50_______5

đầu ra

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life

 

Truy cập các phần tử của String

Trong Python, có thể truy cập các ký tự riêng lẻ của Chuỗi bằng cách sử dụng phương thức Lập chỉ mục. Lập chỉ mục cho phép các tham chiếu địa chỉ phủ định truy cập các ký tự từ phía sau Chuỗi, e. g. -1 đề cập đến ký tự cuối cùng, -2 đề cập đến ký tự cuối cùng thứ hai, v.v.

Python3




String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
14

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
15

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
7_______7_______1
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
19

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______22
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______50_______5

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
27

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______30
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______0_______33
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
34
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
35

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
37

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______40
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______0_______33
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
44
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
45
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
35

đầu ra

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s

 

Lưu ý – Để biết thêm về chuỗi, hãy tham khảo Chuỗi Python

2] Danh sách

Danh sách cũng giống như mảng, được khai báo bằng các ngôn ngữ khác là tập hợp dữ liệu có thứ tự. Nó rất linh hoạt vì các mục trong danh sách không cần phải cùng loại
 

Tạo danh sách

Danh sách trong Python có thể được tạo bằng cách đặt chuỗi bên trong dấu ngoặc vuông_______0_______47

Python3




String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
48

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
49

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
51

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
52
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
54

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______57
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______52
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
64

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
65

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
52
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
69
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
70

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______73
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______52
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
80

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
81

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
52
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68_______0_______85_______7_______6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
87
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
85_______0_______70

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______93
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______52
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
34
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
00

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______52
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
2
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
35

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
08

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
09

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
52
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
12_______7_______13_______7_______6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
15
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
16
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
13
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
18

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
21
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______52
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

đầu ra

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]

 

Truy cập các phần tử của Danh sách

Để truy cập các mục danh sách, hãy tham khảo số chỉ mục. Sử dụng toán tử chỉ mục

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
27 để truy cập một mục trong danh sách. Trong Python, các chỉ mục chuỗi âm biểu thị các vị trí từ cuối mảng. Thay vì phải tính phần bù như trong
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
28, chỉ cần viết
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
29 là đủ. Lập chỉ mục phủ định có nghĩa là bắt đầu từ cuối, -1 đề cập đến mục cuối cùng, -2 đề cập đến mục cuối cùng thứ hai, v.v.

Python3




String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
48

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
31

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
80

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
81

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
52
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68_______0_______85_______7_______6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
87
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
85_______0_______70

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
45

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
46

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______7_______49
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______52
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
34
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
00

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______52
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
2
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
35

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
64

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
65

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
68
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
71

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______52
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
44
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
45
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
35

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
80

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
52
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
44
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
86
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
35

đầu ra

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks

Lưu ý - Để biết thêm về Danh sách, hãy tham khảo Danh sách Python

 

3] Bộ ba

Cũng giống như danh sách, bộ dữ liệu cũng là một tập hợp các đối tượng Python có thứ tự. Sự khác biệt duy nhất giữa bộ dữ liệu và danh sách là bộ dữ liệu là bất biến. e. bộ dữ liệu không thể được sửa đổi sau khi nó được tạo. Nó được đại diện bởi lớp

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
88
 

Tạo Tuple

Trong Python, các bộ dữ liệu được tạo bằng cách đặt một chuỗi các giá trị được phân tách bằng 'dấu phẩy' có hoặc không sử dụng dấu ngoặc đơn để nhóm chuỗi dữ liệu. Các bộ dữ liệu có thể chứa bất kỳ số lượng phần tử nào và của bất kỳ kiểu dữ liệu nào [như chuỗi, số nguyên, danh sách, v.v. ]

Ghi chú. Các bộ dữ liệu cũng có thể được tạo bằng một phần tử duy nhất, nhưng hơi phức tạp một chút. Có một phần tử trong ngoặc là không đủ, phải có dấu 'dấu phẩy' ở cuối để biến nó thành một bộ

Python3




String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
48

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
90

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
92

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
93______7_______1
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
95

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______7_______98
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
01

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
03

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
04

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
93_______7_______1
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
4
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
13_______7_______6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
15
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
14
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______17_______01

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
19

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
20

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
21
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
68
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
45_______7_______6
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
2
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
28
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
2
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
32
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
70

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
36
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
88
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
41

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
43

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
44

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
93_______7_______1
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
88
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
4
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
13
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
53
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______17_______01

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
58

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
59

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
93_______7_______1
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
4_______0_______34_______7_______6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
45
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
2
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
86
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
71
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
4
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
74
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
76
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
78
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
80

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
83
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______17_______86

đầu ra

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]

 

Lưu ý - Việc tạo bộ dữ liệu Python mà không sử dụng dấu ngoặc đơn được gọi là Đóng gói bộ dữ liệu

Truy cập các phần tử của Tuple

Để truy cập các mục Tuple, hãy tham khảo số chỉ mục. Sử dụng toán tử chỉ mục

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
27 để truy cập một mục trong bộ dữ liệu. Chỉ số phải là một số nguyên. Các bộ dữ liệu lồng nhau được truy cập bằng cách sử dụng chỉ mục lồng nhau

Python3




String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
7

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
89

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
91
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
88
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
94
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
45
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
2
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
86
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
28
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
2
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
04

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
06

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______27_______09
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
10

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______27_______12
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
34
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
04

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
16

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
17

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
20
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
10

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______27_______12
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
44
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
45
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
04

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______27_______30
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
10

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______27_______12
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
44
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
86
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
04

đầu ra

First element of tuple
1

Last element of tuple
5

Third last element of tuple
3

Lưu ý - Để biết thêm về các bộ dữ liệu, hãy tham khảo Python Tuples

Boolean

Loại dữ liệu có một trong hai giá trị tích hợp sẵn,

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
37or
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
38. Các đối tượng Boolean bằng True là đúng [đúng] và những đối tượng bằng Sai là sai [sai]. Nhưng các đối tượng không phải Boolean cũng có thể được đánh giá trong ngữ cảnh Boolean và được xác định là đúng hay sai. Nó được ký hiệu là lớp
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
39

Lưu ý - Đúng và Sai với chữ 'T' và 'F' viết hoa là các phép toán hợp lệ nếu không python sẽ báo lỗi

Python3




String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
7

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
41

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______7_______7
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
4_______27_______37
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
48

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______7_______7
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
4_______27_______38
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
48

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
7
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
59

đầu ra


Traceback [most recent call last]:
  File "/home/7e8862763fb66153d70824099d4f5fb7.py", line 8, in 
    print[type[true]]
NameError: name 'true' is not defined
Bộ

Trong Python, Set là một tập hợp kiểu dữ liệu không có thứ tự, có thể lặp lại, có thể thay đổi và không có phần tử trùng lặp. Thứ tự các phần tử trong một tập hợp không xác định mặc dù nó có thể bao gồm nhiều phần tử khác nhau

Tạo bộ

Có thể tạo các bộ bằng cách sử dụng hàm

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
60 tích hợp với một đối tượng có thể lặp lại hoặc một chuỗi bằng cách đặt chuỗi bên trong dấu ngoặc nhọn, được phân tách bằng 'dấu phẩy'. Loại phần tử trong một tập hợp không nhất thiết phải giống nhau, các giá trị loại dữ liệu hỗn hợp khác nhau cũng có thể được chuyển đến tập hợp

Python3




String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
48

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
62

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
64

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
65
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
67
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
95

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______27_______71
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______27_______74

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
76

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
65

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
65
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
67
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
4
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
19
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______27_______86
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______27_______74

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
91

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
92

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
65
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
67
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
94
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
85
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
87
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
85
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
35

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______37_______05
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______27_______74

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
9

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
76

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
11

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
12

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
65
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
67
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
94
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
45
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
2
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
13
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
28
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
15
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
32_______7_______6_______7_______13_______0_______35

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______37_______33
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______27_______74

đầu ra

Initial blank Set: 
set[]

Set with the use of String: 
{'F', 'o', 'G', 's', 'r', 'k', 'e'}

Set with the use of List: 
{'Geeks', 'For'}

Set with the use of Mixed Values
{1, 2, 4, 6, 'Geeks', 'For'}

 

Truy cập các phần tử của Sets

Không thể truy cập các mục của tập hợp bằng cách tham chiếu đến một chỉ mục, vì các tập hợp không có thứ tự nên các mục không có chỉ mục. Nhưng bạn có thể lặp qua các mục của tập hợp bằng cách sử dụng vòng lặp for hoặc hỏi xem giá trị đã chỉ định có tồn tại trong một tập hợp hay không bằng cách sử dụng từ khóa

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
37

Python3




Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
38

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
39

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
41

Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
65
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Accessing element from the list
Geeks
Geeks
Accessing element using negative indexing
Geeks
Geeks
67
Initial blank List: 
[]

List with the use of String: 
['GeeksForGeeks']

List containing multiple values: 
Geeks
Geeks

Multi-Dimensional List: 
[['Geeks', 'For'], ['Geeks']]
94
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
85
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
87
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
85
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
35

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______37_______54
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______27_______74

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
59

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
60

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______37_______63
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
65
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
66
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
37
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
68

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
69_______7_______3
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
71
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
73
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
3

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
4

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
76

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
77

Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
3_______7_______4_______0_______85
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
37
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
82

đầu ra

String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
0

 

Lưu ý - Để biết thêm về các bộ, hãy tham khảo Bộ Python

Từ điển

Từ điển trong Python là một tập hợp các giá trị dữ liệu không có thứ tự, được sử dụng để lưu trữ các giá trị dữ liệu như bản đồ, không giống như các Loại dữ liệu khác chỉ chứa một giá trị dưới dạng một phần tử, Từ điển chứa các cặp

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
83. Khóa-giá trị được cung cấp trong từ điển để tối ưu hóa hơn. Mỗi cặp khóa-giá trị trong Từ điển được phân tách bằng dấu hai chấm
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
84, trong khi mỗi khóa được phân tách bằng 'dấu phẩy'

Tạo từ điển

Trong Python, Từ điển có thể được tạo bằng cách đặt một chuỗi các phần tử trong dấu ngoặc nhọn

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
85, được phân tách bằng 'dấu phẩy'. Các giá trị trong từ điển có thể thuộc bất kỳ kiểu dữ liệu nào và có thể được sao chép, trong khi các khóa không thể lặp lại và phải không thay đổi. Từ điển cũng có thể được tạo bằng chức năng tích hợp
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
86. Một từ điển trống có thể được tạo bằng cách chỉ cần đặt nó vào dấu ngoặc nhọn{}

Lưu ý – Các khóa từ điển có phân biệt chữ hoa chữ thường, cùng tên nhưng khác chữ hoa chữ thường sẽ được xử lý khác biệt

Python3




Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
87

Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
88
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
1
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
04
String with the use of Single Quotes: 
Welcome to the Geeks World

String with the use of Double Quotes: 
I'm a Geek


String with the use of Triple Quotes: 
I'm a Geek and I live in a world of "Geeks"


Creating a multiline String: 
Geeks 
            For 
            Life
45
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
84
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
13
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6

15
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
84
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
15
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
6
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
86
Initial empty Tuple: 
[]

Tuple with the use of String: 
['Geeks', 'For']

Tuple using List: 
[1, 2, 4, 5, 6]

Tuple with the use of function: 
['G', 'e', 'e', 'k', 's']

Tuple with nested tuples: 
[[0, 1, 2, 3], ['python', 'geek']]
84
Initial String: 
GeeksForGeeks

First character of String is: 
G

Last character of String is: 
s
13
First element of tuple
1

Last element of tuple
5

Third last element of tuple
3
16

Các kiểu dữ liệu trong Python là gì?

Một số kiểu dữ liệu Python tích hợp sẵn là. .
Kiểu dữ liệu số. int, float, phức tạp
Kiểu dữ liệu chuỗi. str
các loại trình tự. danh sách, tuple, phạm vi
loại nhị phân. byte, bytearray, memoryview
Loại dữ liệu ánh xạ. mệnh lệnh
kiểu Boolean. bool
Đặt kiểu dữ liệu. bộ, bộ đóng băng. Kiểu dữ liệu số Python

Các kiểu dữ liệu Lớp 11 là gì?

Dấu chấm động, số nguyên, kép, ký tự. Liên kết, cấu trúc, mảng , v.v.

Có bao nhiêu loại dữ liệu trong Python Lớp 11?

Trong ngôn ngữ lập trình như Python, chủ yếu có 4 kiểu dữ liệu. Chuỗi – Đó là tập hợp các ký tự Unicode [chữ cái, số và ký hiệu] mà chúng ta thấy trên bàn phím. Số - Các loại dữ liệu này lưu trữ các giá trị số như số nguyên, số dấu phẩy động và số phức.

Các loại dữ liệu cốt lõi trong Python Lớp 11 là gì?

Kiểu dữ liệu Python chủ yếu có 3 loại. Boolean, số nguyên và chuỗi . Đây cũng có thể được gọi là các kiểu dữ liệu cốt lõi trong Python.

Chủ Đề