Python 一問

2008-01-24 4:12 am
如何輸入指數?
我打 2^2
出了0而不是4

回答 (1)

2008-01-24 11:52 am
✔ 最佳答案
I believe ^ is used for exclusive or, as in C, that is why it returned a zero.
To do exponentiation, try the ** operator, as in good old Fortran or Perl.
2**3 should give 8, 5**3 gives 125, etc.


收錄日期: 2021-04-13 15:01:40
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080123000051KK03113

檢視 Wayback Machine 備份