Skip to content

Commit c2964ff

Browse files
committed
First Commit
0 parents  commit c2964ff

File tree

4 files changed

+8490
-0
lines changed

4 files changed

+8490
-0
lines changed

my_select_query.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import csv
2+
3+
class MySelectQuery:
4+
def __init__(self, csv_content):
5+
self.rows = []
6+
for row_str in csv_content.strip().split('\n'):
7+
self.rows.append(row_str.strip().split(','))
8+
self.columns = self.rows[0]
9+
self.rows = self.rows[1:]
10+
11+
def where(self, column_name, criteria):
12+
result = []
13+
for row in self.rows:
14+
if row[self.columns.index(column_name)] == criteria:
15+
result.append(','.join(row))
16+
return result

0 commit comments

Comments
 (0)