Code: Alles auswählen
import math
import sys
datei="Datei0.txt"
try:
d=open(datei)
print("Datei erfolgreich geöffnet")
except:
print(datei)
sys.exit("Datei nicht gefunden")
d.close
anzahl=0.0
for i in range (1,100000000):
zeile=d.readline()
if (zeile==""):
break
anzahl=anzahl+1
teile=zeile.split(";")
x=float(teile[0])
y=float(teile[1])
z=float(teile[2])
Distanz=math.sqrt((x-x)**2+(y-y)**2+(z-z)**2);
print("Entfernung: ",Distanz,"km")
print("Anzahl der Koordinaten: ",anzahl)
Das ist der Code den ich im Moment habe und bin mir nicht sicher wie ich jetzt weitermachen soll.
Mfg Ruwen