Question: #python lists and reading files #im trying to make a list A, where A[i] = 1 - R[i] - T[i] # just ... #im trying
#python lists and reading files #im trying to make a list A, where A[i] = 1 - R[i] - T[i] # just ...
#im trying to make a list A, where A[i] = 1 - R[i] - T[i] # just use the first 500 values from R and T as they are different lengths
# # find T list at https://pastebin.com/y2Uby5eF .............. # find R list at https://pastebin.com/nX2Y6TVH # each answer in A should be between 0 and 1
################################ making R list # find R list at https://pastebin.com/nX2Y6TVH f=open('R 77777.txt',"r") lines=f.readlines() R=[] for x in lines: R.append(x.split(' ')[2]) R = [s.rstrip() for s in R] f.close()
################################### making T list # find T list at https://pastebin.com/y2Uby5eF f=open('T 77777.txt',"r") lines=f.readlines() T=[] for x in lines: T.append(x.split(' ')[2]) T = [s.rstrip() for s in T] f.close()
################################## making a list of 1's Z=1 list_of_ones=[] for i in range(len(R)): list_of_ones.append(Z)
################################## each A = 1 - R[i] - T[i] A=[] for i in range(len(R)): A.append(list_of_ones[i] - R[i] - T[i])
print(A)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
