<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
It just outputs 1 loads of times
<What do you expect to happen instead?>
I want my code to loop through a file (which is saved as a .txt) and split it into sections which have the " : " after it. Then I want it to get all the numbers from column 6 to get subtract by column 5 and print it out afterward.
count = 4
count2 = 5
numbers = open(“number.txt”, “r”)
number = numbers.split(’:’)
for lines in number:
number_1 = number[count]
number_2 = number[count2]
total = (int(number_1)) - (int(number_2))
print total
count = 3
count2 = 4
count3 = 5
numbers.close()
Example of file -
10 : 11 : 12 : 13 : 14 : 15 : 16 :
<do not remove the three backticks above>