I am having trouble coding my distance/midpoint calculator in my chatter 2.0. I have written my calculator code on a website called py3.codeskulptor.org. The problem I have is that I canβt figure out how to code it in a way that uses the buttons to input the numbers. To any one who knows how to do that, please send me the python code so I can use it on my chatter.
This is the python code.
import math
x1=float(input(βEnter x1.β))
y1=float(input(βEnter y1.β))
print((β(β)+str(x1)+(" , β)+str(y1)+(β)."))
x2=float(input(βEnter x2.β))
y2=float(input(βEnter y2.β))
print((β(β)+str(x2)+(" , β)+str(y2)+(β)."))
x3=x2-x1
x4=x3**2
y3=y2-y1
y4=y3**2
a1=x4+y4
a2=math.sqrt(a1)
x5=x1+x2
x6=x5/2
y5=y1+y2
y6=y5/2
print((βThe equation for the distance is β(β)+(str(x2))+(β-β)
+(str(x1))+(β)Β²+(β)+(str(y2))+(β-β)+(str(y1))+(β)Β²β))
print(βThe steps are as follows:β)
print(("1. Subtract β)+(str(x1))+(β from ")+(str(x2))
+(" which equals β)+(str(x3))+(β."))
print(("2. Subtract β)+(str(y1))+(β from ")+(str(y2))
+(" which equals β)+(str(y3))+(β."))
print(("3. Multiply ")+(str(x3))
+(" to the power of 2 which equals β)+(str(x4))+(β."))
print(("4. Multiply ")+(str(y3))
+(" to the power of 2 which equals β)+(str(y4))+(β."))
print(("5. Add β)+(str(x4))+(β to ")+(str(y4))
+(" which equals β)+(str(a1))+(β."))
print(("6. Find the square root of β)+(str(a1))+(β which equals ")
+(str(a2))+(β.β))
print(βThat is your distance.β)
print((βIf you get a realy big number then just write ββ)+(str(a1))
+(" for you distance.\n"))
print((βThe equation for midpoint is ((β)+(str(x1))+(β+β)+(str(x2))
+(β)Γ·2),((β)+(str(y1))+(β+β)+(str(y2))+(β)Γ·2)β))
print(βThe steps are as follows:β)
print(("1. Add β)+(str(x1))+(β to β)+(str(x2))+(β which equals ")
+(str(x5))+(β.β))
print(("2. Divide β)+(str(x5))+(β by 2 which equals ")+(str(x6))
+(β. This is the X coordinate of \nthe midpoint.β))
print(("3. Add β)+(str(y1))+(β to β)+(str(y2))+(β which equals ")
+(str(y5))+(β.β))
print(("4. Divide β)+(str(y5))+(β by 2 which equals ")+(str(y6))
+(β. This is the Y coordinate of \nthe midpoint.β))
print((βThe midpoint is β)+β(β+str(x6)+β,β+str(y6)+β).β)