Common Python Bugs Jan 10, 2017 Bug 1 if foo == 42: print('Hello!') Bug 2 someVar = 42 def myFunction(): print(someVar) someVar = 100 myFunction() Bug 3 myName = 'Jim' print('My name is ' + myName + . How are you?') Bug 4 foo = range(10) foo[4] = -1 Bug 5 foo = ['cat', 'dog', 'mouse'] for i in range(foo): print(foo[i]) Bug 5 foo = ['cat', 'dog', 'mouse'] print(foo[6]) Bug 6 foo = Round(4.2) Bug 7 foo = 0 foo++ Bug 8 print('Hello!) Bug 9 numEggs = 12 print('I have ' + numEggs + ' eggs.') Bug 10 foo = 'I have a pet cat.' foo[13] = 'r' print(foo) Bug 11 class = 'algebra' Bug 12 if foo == 42: print('Hello!') Bug 13 foo = 0 foo += 42 eggs += 42 Bug 14 if foo == 42: print('Hello!') print('O hai!') Bug 15 foo = ruond(4.2) Bug 16 foo = 'THIS IS IN LOWERCASE.' foo = foo.lowerr() Bug 17 class Foo(): def myMethod(): print('Hello!') a = Foo() a.myMethod() Bug 18 print(Hello!') Bug 19 foo = {'cat': 'Zophie', 'dog': 'Basil', 'mouse': 'Whiskers'} print('The name of my pet zebra is ' + foo['zebra']) Bug 20 foobar = 'Jim' print('My name is ' + fooba)