Is there an operator to calculate percentage in Python?

后端 未结 5 662
予麋鹿
予麋鹿 2020-12-23 19:27

I\'ve recently learned that the \" % \" sign is used to calculate the remainder of an integer in Python. However I was unable to determine if there\'s another operator or me

5条回答
  •  青春惊慌失措
    2020-12-23 19:58

    There is no such operator in Python, but it is trivial to implement on your own. In practice in computing, percentages are not nearly as useful as a modulo, so no language that I can think of implements one.

提交回复
热议问题