Mittpunktsformeln i Python: Skillnad mellan sidversioner
Hoppa till navigering
Hoppa till sök
Hakan (diskussion | bidrag) |
Hakan (diskussion | bidrag) |
||
| Rad 28: | Rad 28: | ||
y1 = float(input('The value of y (the first endpoint) ')) | y1 = float(input('The value of y (the first endpoint) ')) | ||
x2 = float(input('The value of x (the | x2 = float(input('The value of x (the second endpoint) ')) | ||
y2 = float(input('The value of y (the | y2 = float(input('The value of y (the second endpoint) ')) | ||
x_m_point = (x1 + x2)/2 | x_m_point = (x1 + x2)/2 | ||
Versionen från 21 januari 2019 kl. 08.35

Mittpunktsformeln
| Uppgift |
|---|
Mittpunktsformeln
|
Python-koden
print('\nCalculate the midpoint of a line :')
x1 = float(input('The value of x (the first endpoint) '))
y1 = float(input('The value of y (the first endpoint) '))
x2 = float(input('The value of x (the second endpoint) '))
y2 = float(input('The value of y (the second endpoint) '))
x_m_point = (x1 + x2)/2
y_m_point = (y1 + y2)/2
print();
print("The midpoint of line is :")
print( "The midpoint's x value is: ",x_m_point)
print( "The midpoint's y value is: ",y_m_point)
print();
Uppgiften är inspirerad av w3resource

