python read函式菜鳥 Python

2021-10-12 11:43:07 字數 841 閱讀 4090

python degrees() 函式

描述degrees() 將弧度轉換為角度。

語法以下是 degrees() 方法的語法:

import math

math.degrees(x)

注意:degrees()是不能直接訪問的,需要匯入 math 模組,然後通過 math 靜態物件呼叫該方法。

引數x -- 乙個數值。

返回值返回乙個角度值。

例項以下展示了使用 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)

以上例項執行後輸出結果為:

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

菜鳥問與答 函式

1 什麼是函式 在c語言中,完成乙個特定任務的程式段 子程式稱作函式,在乙個完整的c程式中,通常是由很多個函式組成的,每乙個函式完成其指定的任務。2 什麼是函式原型 乙個函式有函式名 函式的返回值及返回值的型別 函式的引數及引數的型別。對函式的所有這些特徵予以描述稱作函式的原型。函式原型一般放在整個...

string函式 菜鳥教程函式

運算子 條件語句 迴圈與js基礎語法類似,就不再記錄了。無返回值函式 定義方式 1function function name 2 有返回值函式 定義方式 1function function name return type 帶引數函式 定義方式 1function func name param...

Python 函式 菜鳥教程

python3函式 菜鳥程式設計 計算面積函式 學習他的呼叫函式方式!def area width,height return width height w 4 h 5 print width w,height h,area area w,h width 4 height 5 area 20 pyt...