0
그래서 선의 기울기를 계산하는 코드를 만들려고합니다. 나는 3.6을 사용하고있다.파이썬 - 십진수 대신 분수 출력
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)
답변을 비합리적으로 만드는 숫자를 넣을 때마다 그 답은 10 진수가됩니다. 그것을 분수로 유지하는 것이 가능합니까?
, 감사합니다! –