Các loại 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 hoạt động có thể được thực hiện trên một dữ liệu cụ thể. Vì mọi thứ là một đối tượng trong lập trình Python, các loại dữ liệu thực sự là các lớp và biến là ví dụ [đối tượng] của các lớp này.
Nội dung chính
- Loại trình tự
- Số nguyên - Giá trị này được biểu thị bằng lớp Int. Nó chứa các số toàn bộ dương hoặc âm [không có phân số hoặc thập phân]. Trong Python, không có giới hạn về giá trị số nguyên có thể là bao lâu.
- Từ điển
- Kiểu dữ liệu số trong Python với ví dụ là gì?
- Loại dữ liệu số nào?
- 4 loại số khác nhau trong Python là gì?
- Hai loại dữ liệu số trong Python là gì?
Sau đây là loại dữ liệu tiêu chuẩn hoặc tích hợp của Python:
- Số
- Loại trình tự
- Số nguyên - Giá trị này được biểu thị bằng lớp Int. Nó chứa các số toàn bộ dương hoặc âm [không có phân số hoặc thập phân]. Trong Python, không có giới hạn về giá trị số nguyên có thể là bao lâu.
- Từ điển
- Từ điển
Số
Loại trình tự
- Số nguyên - Giá trị này được biểu thị bằng lớp Int. Nó chứa các số toàn bộ dương hoặc âm [không có phân số hoặc thập phân]. Trong Python, không có giới hạn về giá trị số nguyên có thể là bao lâu.– This value is represented by int class. It contains positive or negative whole numbers [without fraction or decimal]. In Python there is no limit to how long an integer value can be.
- Từ điển– This value is represented by float class. It is a real number with floating point representation. It is specified by a decimal point. Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation.
- Kiểu dữ liệu số trong Python với ví dụ là gì? – Complex number is represented by complex class. It is specified as [real part] + [imaginary part]j. For example – 2+3j
Loại dữ liệu số nào?
4 loại số khác nhau trong Python là gì?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 Life4and
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 Life5Class trong Python. – Hai loại dữ liệu số trong Python là gì?
Python3
Số nguyên - Giá trị này được biểu thị bằng lớp Int. Nó chứa các số toàn bộ dương hoặc âm [không có phân số hoặc thập phân]. Trong Python, không có giới hạn về giá trị số nguyên có thể là bao lâu.
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s2
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s4
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s5
Từ điển
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life21
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s4
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 Life24
Kiểu dữ liệu số trong Python với ví dụ là gì?
Loại dữ liệu số nào?
4 loại số khác nhau trong Python là gì?Output:
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 Life7
Loại trình tự
Số nguyên - Giá trị này được biểu thị bằng lớp Int. Nó chứa các số toàn bộ dương hoặc âm [không có phân số hoặc thập phân]. Trong Python, không có giới hạn về giá trị số nguyên có thể là bao lâu.
- Từ điển
- Từ điển
- Kiểu dữ liệu số trong Python với ví dụ là gì?
Số nguyên - Giá trị này được biểu thị bằng lớp Int. Nó chứa các số toàn bộ dương hoặc âm [không có phân số hoặc thập phân]. Trong Python, không có giới hạn về giá trị số nguyên có thể là bao lâu.
Loại dữ liệu số nào?
Kiểu dữ liệu số trong Python với ví dụ là gì?
Loại dữ liệu số nào?
4 loại số khác nhau trong Python là gì?Python3
Hai loại dữ liệu số trong Python là gì?Output:
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
Initial String:
GeeksForGeeks
First character of String is:
G
Last character of String is:
s
0Initial String:
GeeksForGeeks
First character of String is:
G
Last character of String is:
s
1Initial String:
GeeksForGeeks
First character of String is:
G
Last character of String is:
s
42Initial String:
GeeksForGeeks
First character of String is:
G
Last character of String is:
s
3Initial String:
GeeksForGeeks
First character of String is:
G
Last character of String is:
s
4Initial String:
GeeksForGeeks
First character of String is:
G
Last character of String is:
s
45
Sau đây là loại dữ liệu tiêu chuẩn hoặc tích hợp của Python:
Python3
Số
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s44
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life75
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life00
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life03
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 Life04
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 Life05
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life08
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life03
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 Life12
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 Life13
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 Life05
Output:
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s
Boolean– To know more about strings, refer Python String.
Bộ
Boolean– This value is represented by int class. It contains positive or negative whole numbers [without fraction or decimal]. In Python there is no limit to how long an integer value can be.
Bộ– This value is represented by float class. It is a real number with floating point representation. It is specified by a decimal point. Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation.
Tạo chuỗi
Python3
Chuỗi trong Python có thể được tạo bằng cách sử dụng trích dẫn đơn hoặc trích dẫn đôi hoặc thậm chí trích dẫn ba.
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life21
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life16
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s47
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s49
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life34
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life16
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s47
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 Life8
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 Life78
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life203
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life16
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 Life29
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 Life04
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 Life58
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life16
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 Life29
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 Life27
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 Life05
Truy cập các thành phần của chuỗi
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life76
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life16
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 Life73
Output:
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 Life2
Trong Python, các ký tự riêng lẻ của chuỗi có thể được truy cập bằng cách sử dụng phương pháp lập chỉ mục. Lập chỉ mục cho phép tham chiếu địa chỉ âm đến các ký tự truy cập từ phía sau chuỗi, ví dụ: -1 đề cập đến nhân vật cuối cùng, -2 đề cập đến nhân vật cuối cùng thứ hai, v.v.
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s47
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s41
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 Life16
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 Life8
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 Life29
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 Life43
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life45
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life43__
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life96
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 Life73
_______
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life16
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 Life29
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 Life27
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 Life05
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s12
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life16
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 Life29
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 Life12
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 Life13
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 Life05
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life16
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 Life29
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 Life12
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s26
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 Life05
Output:
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s4
Lưu ý - Để biết thêm về danh sách, hãy tham khảo danh sách Python.– To know more about Lists, refer Python List.– To know more about Lists, refer Python List.
3] Tuple
Giống như danh sách, Tuple cũng là một bộ sưu tập các đối tượng Python được đặt hàng. Sự khác biệt duy nhất giữa tuple và danh sách là các bộ dữ liệu là bất biến, tức là các bộ dữ liệu không thể được sửa đổi sau khi nó được tạo ra. Nó được đại diện bởi ________ 228 Class. & Nbsp;
Tạo tuple
Trong Python, các bộ dữ liệu được tạo ra 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. Tuples có thể chứa bất kỳ số lượng phần tử và của bất kỳ kiểu dữ liệu nào [như chuỗi, số nguyên, danh sách, v.v.].
Lưu ý: Bộ dữ liệu cũng có thể được tạo với một phần tử duy nhất, nhưng nó hơi khó khăn. Có một yếu tố trong dấu ngoặc đơn là không đủ, phải có một dấu vết dấu vết để biến nó thành một tuple. Tuples can also be created with a single element, but it is a bit tricky. Having one element in the parentheses is not sufficient, there must be a trailing ‘comma’ to make it a tuple. Tuples can also be created with a single element, but it is a bit tricky. Having one element in the parentheses is not sufficient, there must be a trailing ‘comma’ to make it a tuple.
Python3
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s29
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s31
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s34
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s37
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s29
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life68
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life70
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s47
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s37
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s51
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 Life8
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 Life29
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 Life13
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life27
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3__
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s66
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s70
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s71
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s29
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s70
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life68
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s80
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s37
Các
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s95
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s98
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life200
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 Life73
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 Life202
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 Life8
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 Life204
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life207
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life210
Output:
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 Life7
Lưu ý - Tạo ra tuple python mà không sử dụng dấu ngoặc đơn được gọi là đóng gói tple.– Creation of Python tuple without the use of parentheses is known as Tuple Packing.– Creation of Python tuple without the use of parentheses is known as Tuple Packing.
Truy cập các yếu 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
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 Life82 để truy cập vào một mục trong một tuple. 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 lập chỉ mục lồng nhau.
Python3
Is
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life228
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 Life229
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life231
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 Life04
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 Life225
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life236
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 Life229
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life231
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 Life12
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 Life13
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 Life225
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life245
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 Life229
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life231
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 Life12
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s26
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 Life225
Output:
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 Life6
Lưu ý - Để biết thêm về các bộ dữ liệu, hãy tham khảo các bộ dữ liệu python.– To know more about tuples, refer Python Tuples.– To know more about tuples, refer Python Tuples.
Boolean
Kiểu dữ liệu với một trong hai giá trị tích hợ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 Life252or
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 Life253. Các đối tượng Boolean bằng với sự thật là sự thật [đúng] và những đối tượng bằng sai là giả [sai]. Nhưng các đối tượng không phải là Boolean cũng có thể được đánh giá trong bối cảnh Boolean và được xác định là đúng hoặc sai. Nó được ký hiệu 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 Life254.
Lưu ý - Đúng và Sai với vốn ’T, và F, là Booleans hợp lệ nếu không Python sẽ gây ra lỗi.– True and False with capital ‘T’ and ‘F’ are valid booleans otherwise python will throw an error.– True and False with capital ‘T’ and ‘F’ are valid booleans otherwise python will throw an error.
Python3
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s4
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life259
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 Life260
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s4
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life253
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 Life260
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s4
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 Life270
Output:
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 Life20
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Bộ
Trong Python, Set là một tập hợp các loại dữ liệu không có thứ tự là có thể sử dụng được, có thể thay đổi và không có các yếu tố trùng lặp. Thứ tự của các phần tử trong một bộ không được xác định mặc dù nó có thể bao gồm các yếu tố khác nhau.
Tạo bộ
Các bộ có thể được tạo bằng cách sử dụng 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 Life271 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 niềng răng xoă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 cần 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
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 Life272
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 Life8
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 Life274
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s31
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life278
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life281
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 Life272
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 Life8
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 Life274
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s41
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life290
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life281
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 Life272
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 Life8
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 Life274
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 Life215
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 Life43
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life45
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3__
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s406
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life281
Các
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s430
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life281
Output:
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s4
Truy cập các yếu tố của các bộ
Đặt các mục không thể được truy cập bằng cách tham khảo một chỉ mục, vì các bộ không được đặt hàng 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 đã đặt bằng cách sử dụng vòng lặp cho vòng lặp hoặc hỏi xem giá trị được chỉ định có xuất hiện trong một tập hợp không, bằng cách sử dụng
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s434Keyword.
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 Life272
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 Life8
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 Life274
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 Life215
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 Life43
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life45
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3__
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s447
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
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 Life281
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s453
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s455
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s456
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s457
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s458
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s459
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s461
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s463
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life43
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s457
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s469
Output:
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 Life0
Lưu ý - Để biết thêm về các bộ, tham khảo các bộ Python. To know more about sets, refer Python Sets. To know more about sets, refer Python Sets.
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 đặt hàng, đượ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ị đơn như một phần tử, từ điển giữ
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s470Pair. Giá trị khóa được cung cấp trong từ điển để làm cho nó được tối ưu hóa hơn. Mỗi cặp giá trị khóa trong một từ điển được phân tách bằng một đại tràng
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s471, trong khi mỗi khóa được phân tách bằng một dấu phẩy.
Tạo từ điển
Trong Python, một từ điển có thể được tạo bằng cách đặt một chuỗi các phần tử trong niềng răng xoăn
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s472, đượ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 nhân đôi, trong khi các khóa có thể được lặp lại và phải là bất biến. Từ điển cũng có thể được tạo bởi chức năng tích hợp
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s473. Một từ điển trống có thể được tạo bằng cách chỉ đặt nó vào niềng răng xoăn {}.
Lưu ý - Khóa từ điển nhạy cảm, cùng tên nhưng các trường hợp khóa khác nhau sẽ được xử lý rõ ràng.– Dictionary keys are case sensitive, same name but different cases of Key will be treated distinctly.– Dictionary keys are case sensitive, same name but different cases of Key will be treated distinctly.
Python3
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s476
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s479
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s487
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 Life13
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s489
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 Life68
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life27
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s489__
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life702
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s487
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 Life711
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s489
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 Life68
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life13
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 Life716__
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life727
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life8
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 Life735
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 Life736
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 Life13
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s489
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 Life68
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life27__
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life751
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life8
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 Life735
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 Life760
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 Life13
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life68
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 Life764
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 Life27__
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life771
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life73
Output:
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 Life1
Truy cập các yếu tố của từ điển
Để truy cập các mục của từ điển, hãy tham khảo tên khóa của nó. Khóa có thể được sử dụng bên trong dấu ngoặc vuông. Ngoài ra còn có một phương pháp gọi là
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 Life777 cũng sẽ giúp truy cập phần tử từ từ điển.
Python3
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life8
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s487
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 Life13
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s489
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 Life68
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s3
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 Life785___
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life795
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life29
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 Life785
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 Life05
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
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 Life605
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 Life73
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s0
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s1
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s474
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 Life610
Initial String: GeeksForGeeks First character of String is: G Last character of String is: s26
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 Life612
Output:
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 Life2Kiểu dữ liệu số trong Python với ví dụ là gì?
Kiểu dữ liệu số trong Python với ví dụ là gì?
Trong Python, loại dữ liệu số đại diện cho dữ liệu có giá trị số.Giá trị số có thể là một số nguyên, số nổi hoặc thậm chí là số phức.Các giá trị này được định nghĩa là int, float và các lớp phức tạp trong Python.Số nguyên - Kiểu dữ liệu này được thể hiện với sự trợ giúp của lớp INT.represents the data that has a numeric value. The numeric value can be an integer, floating number, or even complex number. These values are defined as int, float, and complex classes in Python. Integers – This data type is represented with the help of int class.represents the data that has a numeric value. The numeric value can be an integer, floating number, or even complex number. These values are defined as int, float, and complex classes in Python. Integers – This data type is represented with the help of int class.
Loại dữ liệu số nào?
Các loại dữ liệu số là các số được lưu trữ trong các cột cơ sở dữ liệu.Các loại dữ liệu này thường được nhóm lại bởi: các loại số chính xác, các giá trị trong đó độ chính xác và tỷ lệ cần được bảo tồn.Các loại chính xác là số nguyên, lớn, thập phân, số, số và tiền.numbers stored in database columns. These data types are typically grouped by: Exact numeric types, values where the precision and scale need to be preserved. The exact numeric types are INTEGER , BIGINT , DECIMAL , NUMERIC , NUMBER , and MONEY .numbers stored in database columns. These data types are typically grouped by: Exact numeric types, values where the precision and scale need to be preserved. The exact numeric types are INTEGER , BIGINT , DECIMAL , NUMERIC , NUMBER , and MONEY .
4 loại số khác nhau trong Python là gì?
Python cung cấp bốn loại số cơ bản: số nguyên đơn giản, số nguyên dài, số điểm nổi và số phức.plain integers, long integers, floating point numbers and complex numbers.plain integers, long integers, floating point numbers and complex numbers.
Hai loại dữ liệu số trong Python là gì?
Kiểu dữ liệu số Python giữ các số nguyên dài [tồn tại trong Python 2.x, không được dùng trong Python 3.x].Float- giữ các số chính xác nổi và nó chính xác lên đến 15 số thập phân.long- holds long integers[exists in Python 2.x, deprecated in Python 3.x]. float- holds floating precision numbers and it's accurate up to 15 decimal places.long- holds long integers[exists in Python 2. x, deprecated in Python 3. x]. float- holds floating precision numbers and it's accurate up to 15 decimal places.