Error demonstration
class Solution(object):
def fib(self,n):
"""
:type n: int
:rtype: int
"""
while(n>0):
if(n==1 or n==2):
return 1
else:
return fib(n-1)+fib(n-2)#error
return
'''
NameError: global name 'fib' is not defined
return fib(n-1)+fib(n-2)
Line 11 in fib (Solution.py)
ret = Solution().fib(param_1)
Line 36 in _driver (Solution.py)
_driver()
Line 48 in <module> (Solution.py)
'''
Solution:
class Solution(object):
def fib(self,n):
"""
:type n: int
:rtype: int
"""
while(n>0):
if(n==1 or n==2):
return 1
else:
return self.fib(n-1)+self.fib(n-2)#Modified
return 0
Read More:
- NameError: name ‘null’ is not defined [How to Solve]
- Python error collection: NameError: name ‘numpy’ is not defined
- “NameError: name ‘re’ is not defined” [How to Solve]
- NameError: name “defaultParams“ is not defined [How to Solve]
- [Solved] Python serializate error: NameError: name ‘JSON’ is not defined
- [Solved] Tensorflow Error: NameError: name ‘layers‘ is not defined
- NameError: name ‘_C‘ is not defined [How to Solve]
- NameError: name ‘xrange‘ is not defined [How to Solve]
- Python parsing JSON Error: NameError: name ‘false’ is not defined
- Crawler overtime error socket.timeout: timed out/NameError: name ‘socket‘ is not defined
- Python+Selenium Error: AttributeError: ‘WebDriver‘ NameError: name ‘By‘ is not defined
- [Solved] selenium.common.exceptions.JavascriptException: Message: javascript error: windows is not defined
- [Solved] Pylint Warning: An attribute defined in json.encoder line 158 hides this methodpylint(method-hidden)
- [Solved] TypeError: Object of type ‘bytes’ is not JSON serializable
- Python error: ‘int’ object is not callable
- [How to Solve] Python TypeError: ‘int‘ object is not subscriptable
- “EncoderDecoder: ‘mit_b1 is not in the backbone registry‘“ [How to Solve]
- Python Selenium: element is not attached to the page document error
- [Solved] bert_as_service startup error: Tensorflow 2.1.0 is not tested!
- [Solved] ModuleNotFoundError: No module named ‘xxx’; ‘xxx’ is not a package