解讀Python中degrees()方法的使用
degrees()方法從弧度轉(zhuǎn)換到度角x
語法
以下是degrees()方法的語法:
degrees(x)
注意:此函數(shù)是無法直接訪問的,所以我們需要導(dǎo)入math模塊,然后需要用math的靜態(tài)對(duì)象來調(diào)用這個(gè)函數(shù)。
參數(shù)
返回值
- x -- 這必須是一個(gè)數(shù)值。
此方法返回一個(gè)角度的度數(shù)值。
例子
下面的例子顯示degrees()方法的使用。
#!/usr/bin/python import math print "degrees(3) : ", math.degrees(3) print "degrees(-3) : ", math.degrees(-3) print "degrees(0) : ", math.degrees(0) print "degrees(math.pi) : ", math.degrees(math.pi) print "degrees(math.pi/2) : ", math.degrees(math.pi/2) print "degrees(math.pi/4) : ", math.degrees(math.pi/4)
當(dāng)我們運(yùn)行上面的程序,它會(huì)產(chǎn)生以下結(jié)果:
degrees(3) : 171.887338539 degrees(-3) : -171.887338539 degrees(0) : 0.0 degrees(math.pi) : 180.0 degrees(math.pi/2) : 90.0 degrees(math.pi/4) : 45.0
相關(guān)文章
深入理解python中if?__name__?==?‘__main__‘
很多python的文件中會(huì)有語句if?__name=='__main__':,一直不太明白,最近查閱了一下資料,現(xiàn)在明白,本文就來深入理解一下,感興趣的可以了解一下2023-08-08
python實(shí)現(xiàn)感知機(jī)模型的示例
這篇文章主要介紹了python實(shí)現(xiàn)感知機(jī)模型的示例,幫助大家更好的理解和學(xué)習(xí)python 機(jī)器學(xué)習(xí)的相關(guān)知識(shí),感興趣的朋友可以了解下2020-09-09
Keras中 ImageDataGenerator函數(shù)的參數(shù)用法
這篇文章主要介紹了Keras中 ImageDataGenerator函數(shù)的參數(shù)用法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-07-07
CNN的Pytorch實(shí)現(xiàn)(LeNet)
本文主要從CNN的Pytorch實(shí)現(xiàn)庫導(dǎo)入,模型定義,數(shù)據(jù)加載、處理,模型訓(xùn)練,代碼匯總等方面入手介紹,運(yùn)用代碼講解相關(guān)內(nèi)容非常的詳細(xì),大家如果有需要了解相關(guān)知識(shí)的可以參考這篇文章2021-09-09
基于python實(shí)現(xiàn)音樂播放器代碼實(shí)例
這篇文章主要介紹了基于python實(shí)現(xiàn)音樂播放器代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-07-07

