This is my code for finding the speed of cars, when it runs it leaves a line between the printed distance(dist)
and the speed
I have looked at how to remove the \n
from the end but all of them that I've seen and tried have made it print out the word dist
and not the number in the variable:
for line in open ('data.txt','r'):
z,x,y,dist=line.rsplit(",")
print(z)
print(x)
print(y)
print(dist)
speed = int(dist)/(int(y)-int(x))
print(speed)