0
Also ich versuche, ein Stück Code zu machen, der die Steigung einer Linie berechnet. Ich benutze 3.6.Python - Ausgabe Bruch statt Dezimal
y1 = float(input("First y point: "))
y2 = float(input("Second y point: "))
x1 = float(input("First X point: "))
x2 = float(input("Second X point: "))
slope = (y2 - y1)/(x2 - x1)
print("The slope is:",slope)
Jedes Mal, wenn ich in Zahlen setzen, die die Antwort irrational machen, kommt die Antwort eine Dezimalzahl zu sein. Ist es möglich, es als Bruchteil zu behalten?
Das funktionierte, danke! –