x = {1: 'a', 2: 'b'} print(x[1])
x = [1, 2, 3] x.append([4, 5]) print(len(x))
x = [1, 2, 3] print(x[2:])
my_dict = {'key1': 'value1', 'key2': 'value2'}
x = (1, 2, 3) print(x[1])
len('string')
x = [1, 2, 3] x.insert(1, 4) print(x)
x = {'a': 1, 'b': 2} y = x.get('a') print(y)
x = [1, 2, 3] y = x.pop() print(y)
def my_function(): pass
try: # code except Exception as e: pass
x = {'a': 1, 'b': 2} y = x.keys() print(list(y))
x = [1, 2, 3] print(x[::-1])
my_tuple = (1, 2, 3)
x = [1, 2, 3] y = x.pop(1) print(y)
x = [1, 2] y = [3, 4] x.extend(y) print(x)
x = {'a': 1, 'b': 2} y = x.popitem() print(y)
x = ' python ' print(x.strip())
x = [3, 1, 2] x.sort() print(x)
x = [1, 2, 3] y = [4, 5] print(x + y)
for index, value in enumerate(['a', 'b', 'c']): print(index, value)
x = {'a': 1, 'b': 2} y = x.setdefault('c', 3) print(y)
x = [1, 2] y = [3, 4] print(x + y)
x = 'hello' print(x[1:4])
list('abc')
x = [1, 2, 2, 3] print(list(set(x)))
x = [1, 2, 3] print(x.index(2))
with open('file.txt', 'w') as f: f.write('Hello, World!')
x = [1, 2, 3] print(x.pop(0))
x = [1, 2, 3] print(x[::-2])
x = {'a': 1} 'a' in x
x = [1, 2, 3] print(x[1:2])
x = [1, 2, 2, 3] print(x.count(2))
x = [1, 2, 3] print(x.pop(1))
x = [1, 2, 3] print(x[::2])
dict1 = {'a': 1} dict2 = {'b': 2} merged = dict1 | dict2 print(merged)
x = (1, 2, 3) print(len(x))
x = 5 print(type(x))
x = 'abc'.replace('a', 'A') print(x)
class MyClass: def __init__(self): pass
x = [1, 2, 3] print(x.count(1))
for item in [1, 2, 3]: print(item)
x = {'a': 1, 'b': 2} print(x.pop('a'))
x = [1, 2, 3] print(x[1:])
x = [1, 2] x.insert(1, 3) print(x)
x = {'a': 1, 'b': 2}
x = [1, 2, 3] print(x[-1])
x = [1, 2, 3] print(x[1])
x = 'hello world'.split() print(x)
x = [1, 2, 3] print(x[::3])