In [8]:
cd code
In [9]:
import errors_01
In [10]:
errors_01.favorite_ice_cream()
LONG tracebacks
Don't the error
Syntax Errors
this text is difficult to read there is no punctuation there is also no capitalization why is this hard because you have to figure out where each sentence ends you also have to figure out where each sentence begins to some extent it might be ambiguous if there should be a sentence break or not
In [12]:
def some_function()
msg = "hello, world"
print(msg)
return msg
In [13]:
def some_function():
msg = "hello, world"
print(msg)
return msg
Note on TABS and Spaces
Variable Name Errors
In [14]:
print(a)
In [15]:
print(hello)
In [16]:
for number in range(10):
count = count + number
print("The count is:" + str(count))
Count = 0
In [17]:
Count = 0
for number in range(10):
count = count + number
print("The count is:" + str(count))
Item errors
In [18]:
letters = ['a', 'b', 'c']
print("Letter #1 is " + letters[0])
print("Letter #2 is " + letters[1])
print("Letter #3 is " + letters[2])
print("Letter #4 is " + letters[3])
File Errors
In [19]:
file_handle = open('myfile.txt', 'r')
In [21]:
file_handle = open('myfile', 'w')
file_handle.read()
In [ ]: