-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataPracticeTest1.py
More file actions
80 lines (56 loc) · 1.3 KB
/
DataPracticeTest1.py
File metadata and controls
80 lines (56 loc) · 1.3 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
def round_the_float(num):
num = round(num, 2)
return num
a = 2.71828
round_the_float(a)
b = a
print(b)
print(round_the_float(a))
print()
def absolute_reciprocal(an_int):
abs(an_int)
an_int = 1 / an_int
return an_int
new_int = -5
(absolute_reciprocal(new_int))
print()
def find_the_positives(a_list):
list_of_positives = []
for i in range(len(a_list)):
if i > 0:
list_of_positives.append(a_list[i])
return (list_of_positives)
my_list = [1, -5, 4, -4, 2, -1, 5, 9]
my_list = (find_the_positives(my_list))
print(my_list)
print()
def add_to_list(a_list, new_item, new_index):
a_list.insert(new_index, new_item)
# my_list = ["L", "O", "N"]
# add_to_list(my_list, 1, "E")
# print(add_to_list(my_list, ))
# print()
def add_a_capitol(a_dict, a_state, a_city):
a_dict[a_state] = a_city
my_capitols = {"Georgia": "Atlanta", "Idaho": "Boise", "Maine": "Augusta"}
my_capitols = add_a_capitol(my_capitols, "Texas", "Austin")
print(my_capitols)
a = 5
b = a
b += 5
c = a
c *= 2
a -= 5
print(a)
print(b)
print(c)
print()
list_1 = ["Bananas", "Apples", "Carrots"]
list_2 = list_1
list_1.sort()
list_2.append("Dewberry")
list_2.reverse()
print(list_1[0])
print(list_2[0])
print()
print()