Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

G tasks completed #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tasks/import1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ def deepseafish():

3) deepseafish() should be located in a file called "something_in_the_deep.py"
"""

from tasks.shallow.deeper.deepest.too_deep import deepseafish
import sys
sys.path.append('./shallow/deeper/deepest/too_deep')
from something_in_the_deep import deepseafish

def whats_at_the_bottom():
return deepseafish()
return deepseafish()


print(whats_at_the_bottom())
12 changes: 9 additions & 3 deletions tasks/inherentence2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ class DependencyParser:
def parse_dep(self):
return "parsing dependencies"


class CustomParser:
# CustomParser now inherits PosTagger, DependencyParsers and their methods.
class CustomParser(PosTagger, DependencyParser):
# pipe_parse now runs when CustomParser is instantiated
def __init__(self, fname, lname):
print("CustomParser instantiated. Running pipe_parse()")
self.pipe_parse()

def pipe_parse(self):
return self.tag_pos(), self.parse_dep()
return self.tag_pos(), self.parse_dep()

parser = CustomParser("Erik", "Kindberg")
10 changes: 6 additions & 4 deletions tasks/list_comp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ def list_comp2(input_list):
>> list_comp2([[1,1],[2,2]])
>> [1,1,2,2]
"""
flatten_list = []
for sublist in input_list:
flatten_list = [item for sublist in input_list for item in sublist]
"""for sublist in input_list:
for item in sublist:
flatten_list.append(item)
flatten_list.append(item)"""

return
return flatten_list

print(list_comp2([[1,1],[2,2],[1,3,54]]))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def deepseafish():
return "bluop bluop bluop"