python: further notes on tuples
This commit is contained in:
		
							parent
							
								
									4c663d79bb
								
							
						
					
					
						commit
						d1a2885ecb
					
				
					 1 changed files with 3 additions and 8 deletions
				
			
		| 
						 | 
					@ -6,6 +6,8 @@ tags: [python, data-structures]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Tuples in Python
 | 
					# Tuples in Python
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TODO: Exapand tuple notes - give more use cases
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tuples are one of the main data-structures or containers in Python. Tuples are useful in cases where you want to group related data and ensure that it will not change.
 | 
					Tuples are one of the main data-structures or containers in Python. Tuples are useful in cases where you want to group related data and ensure that it will not change.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tuples have the following properties:
 | 
					Tuples have the following properties:
 | 
				
			||||||
| 
						 | 
					@ -26,16 +28,9 @@ As with all containers in Python they permit any data type.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```python
 | 
					```python
 | 
				
			||||||
tup1 = (1, 3, 5, 7)
 | 
					tup1 = (1, 3, 5, 7)
 | 
				
			||||||
print(tup1[0])
 | 
					 | 
				
			||||||
print(tup1[1])
 | 
					 | 
				
			||||||
print(tup1[2])
 | 
					print(tup1[2])
 | 
				
			||||||
print(tup1[3])
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
"""
 | 
					# 5
 | 
				
			||||||
1
 | 
					 | 
				
			||||||
3
 | 
					 | 
				
			||||||
5
 | 
					 | 
				
			||||||
7
 | 
					 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue