-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_and_string.py
More file actions
51 lines (34 loc) · 884 Bytes
/
Copy pathlist_and_string.py
File metadata and controls
51 lines (34 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
alphabet_list = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
print(alphabet_list[0])
print(alphabet_list[1])
print(alphabet_list[4])
print(alphabet_list[-1])
print(alphabet_list[0:5])
print(alphabet_list[4:])
print(alphabet_list[:4])
alphabet_string = 'ABCDEFGHIJ'
print(alphabet_string[0])
print(alphabet_string[1])
print(alphabet_string[4])
print(alphabet_string[-1])
print(alphabet_string[0:5])
print(alphabet_string[4:])
print(alphabet_string[:4])
str_1 = 'Hello'
str_2 = 'World'
str_3 = str_1 + str_2
print(str_3)
list_1 = [1, 2, 3, 4]
list_2 = [5, 6, 7, 8]
list_3 = list_1 + list_2
print(list_3)
my_list = [2, 3, 5, 7, 11]
print(len(my_list))
my_string = 'Hello world!'
print(len(my_string))
numbers = [1, 2, 3, 4]
numbers[0] = 5
print(numbers)
# name = 'codeit'
# name[0] = 'C'
# print(name) # TypeError: 'str' object does not support item assignment