# Python TQC考題108座標距離計算
x1=eval(input()) #2
y1=eval(input()) #1
x2=eval(input()) #5.5
y2=eval(input()) #8
dist=((x1-x2)**2+(y1-y2)**2)**0.5
import math #第二種作法
dist1=math.sqrt((x1-x2)**2+(y1-y2)**2)
# math.pow()可以做2次方,但**比較簡短
print(“( {:} , {:} )”.format(x1,y1))
print(“( {:} , {:} )”.format(x2,y2))
print(“Distance = {:.4f}”.format(dist))
print(dist1)
#第二種作法,只確認答案一樣,格式要再設定好


#tuple確實跟題目要的座標樣式很像
#可惜x1, x2的前後少了空白

#這一題基本上沒有難度
#就是考空白的位置是否正確

![Python: matplotlib繪圖,如何限定座標軸範圍? plt.axis([xmin, xmax, ymin, ymax]) Python: matplotlib繪圖,如何限定座標軸範圍? plt.axis([xmin, xmax, ymin, ymax])](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2023/02/20230208101745_93.jpg?quality=90&zoom=2&ssl=1&resize=350%2C233)




![Python: 如何在pandas.read_csv() or pandas.read_excel() 中使用keep_default_na =False , na_values =[] 保留文件中的原始“NA”? Python: 如何在pandas.read_csv() or pandas.read_excel() 中使用keep_default_na =False , na_values =[] 保留文件中的原始“NA”?](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2024/05/20240530215737_0.png?quality=90&zoom=2&ssl=1&resize=350%2C233)




近期留言