•Some logic errors are due to typos
-Forgetting to indent
-Misspelling a variable
-Typing the wrong variable name
•Some logic errors are due to misunderstandings
-The programmer might have thought an approach would work, but it doesn't
•The debugging process will handle these
Give this one a try later!
Logic Errors
•They can create artificial boundaries
•It is not always clear how things can be separated
, •They don't capture all relationships
•For individual applications, there can be drawbacks
Give this one a try later!
Disadvantages of Hierarchies
x,y
1.0,0.0
2.0,3.0
3.0,8.0
4.0,15.0
5.0,24.0
6.0,35.0
7.0,48.0
8.0,63.0
9.0,80.0
10.0,99.0
Give this one a try later!
import numpy as np
x = np.linspace(1.0, 10.0, 10)
y = x ** 2 - 1
with open('zfile.txt', 'w') as zfile:
zfile.write('x\ty\n')
for i in range(len(x)):
mystr = str(x[i]) + '\t' + str(y[i])
zfile.write(mystr + '\n')
with open('zfile.txt') as myfile:
all_of_it = myfile.read().split('\t')
output = ','.join(all_of_it)
print(output)
-Forgetting to indent
-Misspelling a variable
-Typing the wrong variable name
•Some logic errors are due to misunderstandings
-The programmer might have thought an approach would work, but it doesn't
•The debugging process will handle these
Give this one a try later!
Logic Errors
•They can create artificial boundaries
•It is not always clear how things can be separated
, •They don't capture all relationships
•For individual applications, there can be drawbacks
Give this one a try later!
Disadvantages of Hierarchies
x,y
1.0,0.0
2.0,3.0
3.0,8.0
4.0,15.0
5.0,24.0
6.0,35.0
7.0,48.0
8.0,63.0
9.0,80.0
10.0,99.0
Give this one a try later!
import numpy as np
x = np.linspace(1.0, 10.0, 10)
y = x ** 2 - 1
with open('zfile.txt', 'w') as zfile:
zfile.write('x\ty\n')
for i in range(len(x)):
mystr = str(x[i]) + '\t' + str(y[i])
zfile.write(mystr + '\n')
with open('zfile.txt') as myfile:
all_of_it = myfile.read().split('\t')
output = ','.join(all_of_it)
print(output)