-
Notifications
You must be signed in to change notification settings - Fork 14
updating type hint for solutions #9
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
base: main
Are you sure you want to change the base?
Conversation
Quick note, can you add common virtual environment names to the |
The |
I pointed out a few, but type hints are missing for many of the variables and nearly all of the parameters in the parameter list. |
|
||
return 0.5 * g * t*t | ||
def fall_distance(t) -> float: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing type hint on parameter t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still missing type hint on parameter t
curr_num = 1 | ||
sol = 1 | ||
for i in range(n-1): | ||
def fib(n) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing type hint on parameter n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still missing type hint on parameter n
@@ -7,7 +7,7 @@ class Taxicab: | |||
""" | |||
Represents a taxicab that tracks the distance traveled when given x and y coordinates | |||
""" | |||
def __init__(self, x, y): | |||
def __init__(self, x, y) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing type hint on x
and y
parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use mypy: https://www.mypy-lang.org/ to check that your type hinting is correct.
@@ -2,13 +2,19 @@ | |||
# Date: 10/29/2020 | |||
# Description: Mutates a given list and by the order of the elements of teh list | |||
|
|||
def reverse_list(lst): | |||
def reverse_list(lst: any) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe any
is a type hint. The recommendation I ready is to call object
for the Any
class. This should be type hinted as list[object]
@@ -2,13 +2,20 @@ | |||
# Date: 10/29/2020 | |||
# Description: Mutates a given list and by the order of the elements of teh list | |||
|
|||
def reverse_list(lst): | |||
def reverse_list(lst: object) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is type hinting a parameter named lst
of any type. I think you mean lst: list[object]
""" | ||
Input: list | ||
Takes in a list and reverses the order of the elements of the list | ||
""" | ||
temp_lst = [] | ||
for i in range(len(lst)-1,-1, -1): | ||
temp_lst: object = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. This should be temp_list: list[object] = []
@branhoff review please