Hi,
I don't get that error because indentation is missing from the code,
For what you seem to be doing a for loop would be easier
I don't get that error because indentation is missing from the code,
math
has not been imported and angle
has not been defined. when asking questions please show code that can be run, that will give the error, also please post the full error trace back in error tags.For what you seem to be doing a for loop would be easier
import math angle = 20 dist=[] for x in range(100): calculation = 400/(math.cos(angle)) dist.append(calculation) print(calculation)i assume the value of x is supposed to be in the calculation somewhere, because it currently just outputs
Output:980.1950083826823
100 times.