-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworksheet.py
247 lines (205 loc) · 5.22 KB
/
worksheet.py
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# def str_challenge(lst: list) -> str:
# string = lst[0]
# dictionary = lst[1]
# dictionary_list = dictionary.split(",")
#
# found_words = []
# for word in dictionary_list:
# if ~string.find(word):
# found_words.append(word)
#
# return found_words
# print(str_challenge(["baseball", "a,ball,cat,rake,base,se,duro"]))
# # => [a, ball, cat..]
# def numb_challenge(lst: list):
# found_numb = []
# moving1 = lst[0]
# moving2 = lst
# # lst = [[3, 1, 2, 4], [4, 2, 7, 0], [3, 2, 1, 4]]
# while moving2 != len(lst):
# for index in lst:
# if index in moving2:
# found_numb.append(index)
# moving1 += 1
# moving2 += 1
# return found_numb
#
#
# print(numb_challenge([[3, 1, 2, 4], [4, 2, 7, 0], [3, 2, 1, 4]]))
# file = [[3, 1, 2, 4], [4, 2, 7, 0], [3, 2, 1, 4]]
# result = []
# numb = set(file[0])
# for index in file[1:]:
# result = numb & (set(index))
# numb = result
#
# print(sorted(list(numb)))
# def intersection(self, nums: list) -> int:
# d = defaultdict(int)
# for nums_i in file:
# for num in nums_i:
# d[num] += 1
# print(d)
#
# char = "1231"
# dic = {}
# for index in char:
# if index in dic:
# dic[index] += 1
# else:
# dic[index] = 1
# for key, val in dic.items():
# if val > 1:
# digit = key
# print(digit)
number, digit = '123', '3'
#
# th, _, new = number.partition(digit)
# t, _, new2 = number.rpartition(digit)
#
#
# if int(new) > int(t):
# print(str(new))
# elif int(new) == int(t):
# print(str(new))
# else:
# print(str(t))
#
# lst = []
# for index in number:
# if index == digit:
# del index
# else:
# res = index
# print(res)
# cap = []
# def difference_of_two_array(nums: list) -> list:
# stor = []
# index1 = set(nums[0])
# for index in nums[1:]:
# ind = index1.difference(set(index))
# index2 = set(index).difference(index1)
# stor.append(list(ind))
# stor.append(list(index2))
# return stor
# print(difference_of_two_array([[1, 2, 3, 4], [8, 4, 1, 3]]))
# def difference_of_two_array(numb1: list, numb2: list) -> list:
# caps = []
# numb = set(numb1).difference(set(numb2))
# numbs = set(numb2).difference(set(numb1))
# caps.append(list(numb))
# caps.append(list(numbs))
# return caps
#
#
# print(difference_of_two_array([1, 2, 3, 4], [8, 4, 1, 3]))
# hashing = ['a', 'a', 'a', 'h', 'h', 'i', 'b', 'a', 'c']
# count = 1
# hole = 0
# hole2 = 1
# maxim = 0
# while hole2 < len(hashing):
# if hashing[hole] is hashing[hole2]:
# count += 1
# hole += 1
# hole2 += 1
# if hashing[hole] is not hashing[hole2]:
# maxim = count
# continue
# count = 0
# elif hashing[hole] != hashing[hole2]:
# maxim = count
#
#
# print(maxim)
names = ['Sade', 'Tola', 'Jide', 'Sunkanmi']
# count = 0
# new_array = []
# for index, name in enumerate(names):
# new_array.append(name)
# count += 1
# if count == 0:
# print(name)
# print("No name to show")
# if index == 2:
# print(name)
# index = 0
# pointer = names[index]
# new_lst = []
# while pointer != len(names):
# new_lst.append(pointer)
# pointer += 1
# print(new_lst)
# lst = []
# dict = {1: 'monday', 2: 'tuesday', 3: 'wednesday'}
# for key, value in dict.items():
# lst.append(value)
# print(lst)
# class Solution:
# def two_sum(nums: list, target: int) -> list:
# store = []
# number = nums[0]
# numbers = len(nums) - 1
# new = nums[numbers]
# while number != new:
# for i, j in enumerate(nums):
# result = number + j
# if result == target:
# store.extend([number, i])
# nums[0] += 1
# for ind, index in enumerate(nums):
# for i, j in enumerate(nums):
# if index + j == target and (index != j) and (ind and i) not in result:
# result.extend([ind, i])
# return store
# print(two_sum(nums=[2, 11, 15, 7, 15, 8, 7], target=22))
# def permutation_all_types(words) -> str:
# for i in range(0, len(words)):
# for j in range(1, len(words)):
# return f'{words[i]} {words[j]}'
#
#
# word = input('Enter any sentence: ')
#
# print(permutation_all_types(words=word))
# return result
# result = []
# nums = [2, 11, 15, 7]
# for ind in range(0, len(nums)):
# for i in range(1, len(nums)):
#
# if nums[ind] + nums[i] == 18 and (ind and i) not in result:
# result.extend([ind, i])
# result.append(i)
# continue
# if [ind, i] or [i, ind] in result:
# continue
# else:
# result.extend([ind, i])
# i += 1
# j += 1
# print(result)
# print()
# fig = [5, 3, 8, 1]
# def filterArray(lst: list, a: int, b: int) -> list:
# result = []
# for i in sorted(lst):
# result.append(i)
#
#
#
# print(filterArray(lst=fig, a=3, b=1))
# data =
# def incr(x):
# return x+1
#
# print(list(map(incr,[10,9,8])))
# sports = ['basketball', 'football', "tennis"]
# for i in range(0, 5):
# print (f'These are the available{sports}')
# sport = input('Enter your sport:' )
# sports.append(sport)
# del(sports[0])
# print(sports)
h = int('0b1001101', 2)
print(h)