Tuples Examples
Student Information:
student = ("John Doe", 20, "Computer Science")
print(student)
Output:
('John Doe', 20, 'Computer Science')
Coordinates:
point = (3.5, -2.8)
print(point[0])
print(point[1])
Output:
3.5
-2.8
Days of the Week:
days = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
for day in days:
print(day)
Output:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Nested Tuple:
contacts = (("John Doe", "john@example.com"), ("Jane Smith", "jane@example.com"))
for contact in contacts:
print(contact)
Output:
('John Doe', 'john@example.com')
('Jane Smith', 'jane@example.com')
Basic Topics
- Introduction to Python
- Basic Syntax and Data Types
- Variables and Operators
- Input
- Conditional statements
- Loops
- Functions
- List
- Tuples
- Sets
- Dictionary
- Modules
- Packages
- Exception Handling
- Read/Write Files