I am trying to write a loop in python that reads a text file of 50 numbers and sorts through the numbers and assigns them to different variables based on their values. I would like variable A to contain values less than 2, variable B to to contain values from 2 to 2.1, Variable c to contain values from 2.1 to 2.25, variable d to contain values from 2.25 to 2.5, and variable e to contain values from 2.25 to 2.5.
My code so far looks like this:
import os
import numpy
os.chdir('/Users/DevEnv')
dispFile = open('output1.txt')
displacement = dispFile.readlines()
dispFile.close()
displacement = [float(i.strip()) for i in displacement]
for i in range (0,50):
displacementval = displacement[i]
if i<2 displacementval()=a():
However, when I try to run this I get an invalid syntax error. I am new to python and programming and would appreciate any help!