Created
May 10, 2019 06:41
-
-
Save anandrajneesh/d1998017ca78ed9cd28ba23debe320b9 to your computer and use it in GitHub Desktop.
Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
items = [12, 2, 'str', [], {}] | |
print(items) | |
for i in range(0, len(items)): | |
print(items[i]) | |
print(items[1:3]) | |
print(items * 3) | |
print(items + items) | |
print(12 in items) | |
items.append(4) | |
print(items) | |
items.extend(items) | |
print(items) | |
print(items.index(12)) | |
print(items.count(12)) | |
items.reverse() | |
print(items) | |
items.reverse() | |
nums = [1, 2, 3, 4, 5, 6, 11, 10] | |
nums.sort() | |
print(nums) | |
x = nums.copy() | |
print(x) | |
x.clear() | |
print(x) | |
for z in items: | |
print(z) | |
items.pop(0) | |
L = [x**2 for x in range(5)] | |
print(L) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment