-1
我從即將到來的最終作業考試中獲得以下代碼片段。獲取python對象的中心
cir=Circle(Point(100,100),50)
rect=Rectangle(Point(50,50),Point(100,100))
line=Line(Point(50,50),Point(80,80))
point=Point(50,100)
該問題詢問以下不工作的代碼行,它可能不止一個。
我不知道這是正確的答案:
1. cir.getX().getCenter()
2. rect.getCenter().getX()
3. line.getX()
4. point.getX()
5. point.getCenter()
的選擇是:
a) 1 and 5
b) 3
c) 1 and 3
d) 2 and 3
e) 1,3,and 5
我認爲3是錯誤的,因爲你不能得到一個線和5的x值是錯誤的,因爲一個點不會有一箇中心,所以這些選項不可用。任何見解都會有所幫助。
沒有各種類別和方法的定義,這是無法回答的。 – phihag
你是什麼意思? –
Python沒有內置的'Circle'。因此,在知道「Circle(...)。getX()」是否返回錯誤信息之前,必須知道「Circle」的定義。 – phihag