## Size of tuple

0 likes • Nov 19, 2022 • 0 views
Python

## More Python Posts

#### Fibonacci Series

0 likes • Nov 18, 2022 • 5 views
Python
`#Python 3: Fibonacci series up to ndef fib(n): a, b = 0, 1 while a < n:     print(a, end=' ')     a, b = b, a+b print()fib(1000)`

#### return byte size

0 likes • Nov 19, 2022 • 1 view
Python
`def byte_size(s):  return len(s.encode('utf-8'))  byte_size('😀') # 4byte_size('Hello World') # 11`

0 likes • Nov 19, 2022 • 0 views
Python
```# Python program to reverse a linked list# Time Complexity : O(n)# Space Complexity : O(n) as 'next'#variable is getting created in each loop.
# Node class

class Node:
# Constructor to initialize the node object	def __init__(self, data):		self.data = data		self.next = None

# Function to reverse the linked list	def reverse(self):		prev = None		current = self.head		while(current is not None):			next = current.next			current.next = prev			prev = current			current = next		self.head = prev
# Function to insert a new node at the beginning	def push(self, new_data):		new_node = Node(new_data)		new_node.next = self.head		self.head = new_node
# Utility function to print the linked LinkedList	def printList(self):		temp = self.head		while(temp):			print temp.data,			temp = temp.next

# Driver program to test above functionsllist = LinkedList()llist.push(20)llist.push(4)llist.push(15)llist.push(85)

#### combine values

0 likes • Nov 19, 2022 • 0 views
Python
```from collections import defaultdict
def combine_values(*dicts):  res = defaultdict(list)  for d in dicts:    for key in d:      res[key].append(d[key])  return dict(res)  d1 = {'a': 1, 'b': 'foo', 'c': 400}d2 = {'a': 3, 'b': 200, 'd': 400}
combine_values(d1, d2) # {'a': [1, 3], 'b': ['foo', 200], 'c': [400], 'd': [400]}```

#### Remove i'th character

0 likes • Nov 19, 2022 • 0 views
Python
```# Python code to demonstrate# method to remove i'th character# Naive Method
# Initializing Stringtest_str = "CodeCatch"
# Printing original stringprint ("The original string is : " + test_str)
# Removing char at pos 3# using loopnew_str = ""
for i in range(len(test_str)):	if i != 2:		new_str = new_str + test_str[i]
# Printing string after removalprint ("The string after removal of i'th character : " + new_str)```

#### curry function

0 likes • Nov 19, 2022 • 1 view
Python
```from functools import partial