-
Notifications
You must be signed in to change notification settings - Fork 1
some code #2
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
some code #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --- | ||
| reviews: | ||
| high_level_summary: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,9 +10,24 @@ | |
| return 'There is no such user' | ||
| else: | ||
| return self.name[user_id] | ||
|
|
||
| def TowerOfHanoi(n , source, destination, auxiliary): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HIGH RISK The 'TowerOfHanoi' method is missing the 'self' parameter, which will cause a 'TypeError' when called. Additionally, recursive calls will fail because the function is defined within the class scope, not the global namespace. This logic currently has 0% test coverage.
|
||
| if n==1: | ||
| print ("Move disk 1 from source",source,"to destination",destination) | ||
| return | ||
| TowerOfHanoi(n-1, source, auxiliary, destination) | ||
| print ("Move disk",n,"from source",source,"to destination",destination) | ||
| TowerOfHanoi(n-1, auxiliary, destination, source) | ||
|
|
||
|
|
||
| def fibonacci_of(n): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HIGH RISK The 'fibonacci_of' method lacks the 'self' parameter and recursive calls will fail as it is not in the global namespace. Move this function outside of the 'Person' class to the module level to use it as a utility function. |
||
| if n in {0, 1}: # Base case | ||
| return n | ||
| return fibonacci_of(n - 1) + fibonacci_of(n - 2) # Recursive case | ||
|
|
||
| if __name__ == '__main__': | ||
| person = Person() | ||
| print('User Abbas has been added with id ', person.set_name('Abbas')) | ||
| print('User associated with id 0 is ', person.get_name(0)) | ||
| print('User associated with id 0 is ', person.get_name(0)) | ||
| eval("person.get_name(0)") | ||
| eval("fibonacci_of(3)") | ||
|
Check failure on line 33 in python/person.py
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| flask==1.0.2 | ||
|
Check warning on line 1 in python/requirements.txt
|
||
| django==1.11.29 | ||
|
Check warning on line 2 in python/requirements.txt
|
||
| requests==2.19.1 | ||
|
Check warning on line 3 in python/requirements.txt
|
||
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.
⚪ LOW RISK
Suggestion: This variable name is excessively long and hinders readability. Use a concise, descriptive name.