python函數示例_帶Python示例的complex()函數

python函數示例

Python complex()函數 (Python complex() function)

complex() function is a library function in Python, it is used to get the complex number from given a real number or/and an imaginary number (which is an optional part), it accepts either a real number only or read and an imaginary number and returns a complex number.

complex()函數是Python中的一個庫函數,用于從給定的實數或/和虛數(這是可選部分)中獲取復數,它僅接受實數,也可以接受讀數和虛數數字并返回一個復數。

Syntax:

句法:

    complex(real [,Imaginary])

Parameter(s):

參數:

  • real – value of a real number

    實數 –實數的值

  • Imaginary – an optional parameter, it's default value is 0.

    虛構 –可選參數,默認值為0。

Return value: complex – it returns a complex type of number containing the value in the form of (real + imaginary*j).

返回值: complex –返回復雜的數字類型,其中包含(real +虛數* j)形式的值。

Example:

例:

    Input:
real = 10
img  = 20
print(complex(real))
print(complex(real, img))
Output:
(10+0j)
(10+20j)

Python code to get the complex number

Python代碼獲取復數

# python code to demonstrate example 
# of complex() function
real = 10
img  = 20
# complex number  by passing real number
print(complex(real))
# complex number  by passing real & img. number
print(complex(real, img))
# complex number by passing real part as 0
print(complex(0))
# complex number by passing real and img. part as 0, 0
print(complex(0,0))
# with float values
real = 10.23
img  = 20.45
# complex number  by passing real number
print(complex(real))
# complex number  by passing real & img. number
print(complex(real, img))

Output

輸出量

(10+0j)
(10+20j)
0j
0j
(10.23+0j)
(10.23+20.45j)

翻譯自: https://www.includehelp.com/python/complex-function-with-example.aspx

python函數示例

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/542971.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542971.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542971.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

windows 下 git 禁用 CRLF 轉換 LF

2019獨角獸企業重金招聘Python工程師標準>>> windows中的換行符為 CRLF, 而在linux下的換行符為LF,所以在執行add . 時出現提示,解決辦法: 刪除根目錄 .git 文件夾禁用自動轉換 > git config --global core.autocrl…

cmd執行sql文件路徑 oracle_oracle 基礎 執行sql文件

Oracle執行外部文件:sql>new.sql執行多個sql文件:1.把所有的文件都放在同一個目錄下,然后在命令行里執行命令:c:>dir/b > d:/1.sql會把所有的sql文件名都輸出到一個sql文件中。2.用UltraEdit打開生成的sql文件,altC切換到…

獲取天氣html,使用htmlparser獲取sohu的天氣預報

首先,我們新建一個類,存放天氣信息/** Created on 2005-3-8** To change the template for this generated file go to* Window>Preferences>Java>Code Generation>Code and Comments*/packageorg.exoplatform.portlets.chinaweather.compon…

使用gulp構建前端(三)

為什么80%的碼農都做不了架構師?>>> 使用gulp構建前端(三) 緊接著上述文章內容,開始新的插件的使用 插件三 gulp-clean-css,作用減小文件大小,并給引用url添加版本號避免緩存,一個需…

c++中atan2函數_atan2()函數以及C ++中的示例

c中atan2函數C atan2()函數 (C atan2() function) atan2() function is a library function of cmath header, it is used to find the principal value of the arc tangent of y/x, where y is the proportion of the y-coordinate and x is the proportion of the x-coordin…

python不合法的布爾表達式_python測試題

一、填空題 1.Python使用符號標示注釋;以劃分語句塊。 2、Python序列類型包括 、、三種; 是Python中唯一的映射類型。 3、Python中的可變數據類型有,不可變數據類 型有。 4、Python的數字類型分為、、等子類型。 5、設s=‘abcdefg’,則s[3]值是 ,s[3:5]值是 , s[:5]值是…

網站html標簽如何優化,網站HTML標簽優化教程

真正需要SEOer掌握并經常使用的HTML標簽也就那么幾個,本小節丈哥seo帶來的是頁面HTML標簽優化。title標簽 – 標題標簽1)title標簽用法網站SEOHTML標簽優化教程 – 丈哥seo2)標題標簽的作用關于網站標題寫法與操作技巧有許多,需要怎么優化標題的朋友可以…

hypot函數_hypot()函數與C ++中的示例

hypot函數C hypot()函數 (C hypot() function) hypot() function is a library function of cmath header, it is used to find the hypotenuse of the given numbers, it accepts two numbers and returns the calculated result of hypotenuse i.e. sqrt(x*x y*y). hypot()…

docker 磁盤問題:device or resource busy

問題:[roothdp-gp-dk02 ~]# docker start 01ea65845e45Error response from daemon: Cannot start container 01ea65845e45: Error getting container 01ea65845e4547be24bc3db0bc3b424faf52b8a0534eb525aa829dd9fd6081c2 from driver devicemapper: Error mounting…

axure form列表_常見的列表頁如何用Axure畫出來

列表頁是PM畫原型的時候最容易碰到的頁面類型,那么如何快速畫出并且展現交互呢?我們從具體的例子開始講解其中的技巧,和各種不同的演變場景。希望初級PM可以通過這篇文章改進下自己的畫法。列表頁基本是由頁面框架,上導航&#xf…

python中divmod_divmod()函數以及Python中的示例

python中divmodPython divmod()函數 (Python divmod() function) divmod() function is a library function, it is used to get the quotient and remainder of given values (dividend and divisor), it accepts two arguments 1) dividend and 2) divisor and returns a tup…

html 輪播圖的鼠標事件,這是圖片輪播的代碼 html+css,怎么加上鼠標懸停移出繼續功能?...

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓.one {position: absolute;width: 500px;height: 400px;overflow: hidden;}.one_cantent img {width: 500px;height: 300px;float: left;}.one_cantent {width: 2500px;height: 400px;position: absolute;left: 0px;animation-name…

微軟Azure云之企業Exchange 2016部署12—配置負載平衡

上幾節我們把Exchange2016郵箱系統配置完畢了,本節我們來配置開通需要對外的端口,并對這些端口進行負載均衡配置,如下圖紅框所示:1.Exchange服務端口Exchange2016需要對外開通以下的端口,來對外提供不同的服務&#xf…

linux多線程求和_linux多線程pthread系列函數詳解

linux多線程pthread系列函數詳解(一)為什么要引入線程線程技術早在60年代就被提出,但是在80年代才真正使用到操作系統中。傳統UNIX也支持多線程概念,但在一個進程中只允許有一個線程,這樣多線程就意味著多進程。現在多線程技術已經被很多操作…

python獨立log示例_帶有Python示例的math.log()方法

python獨立log示例Python math.log()方法 (Python math.log() method) math.log() method is a library method of math module, it is used to get the natural logarithm of a given number to base e (by default). It accepts the number and a base (which an optional) a…

搭建云計算機win10,win10電腦做云服務器

彈性云服務器 ECS彈性云服務器(Elastic Cloud Server)是一種可隨時自助獲取、可彈性伸縮的云服務器,幫助用戶打造可靠、安全、靈活、高效的應用環境,確保服務持久穩定運行,提升運維效率三年低至5折,多種配置可選了解詳情Windows遠…

聚類分析在用戶行為中的實例_用戶關注行為數據分析過程詳解-描述統計+聚類...

以下是基于一小段用戶關注產品的行為數據分析過程詳細描述,各位老師如有不同意見或優化建議,還請不吝賜教。一、數據大致是這樣的(已經脫敏處理)二、數據預處理從年款提取出年限,從價格標識出價格區間,隨便寫一下SQL如下&#xff…

centos下升級jdk版本

2019獨角獸企業重金招聘Python工程師標準>>> 由于安裝的centos系統,自帶了jdk1.6和1.7的版本,介于在平時開發,用了1.8.為了保持開發環境的一致,故此需要升級,放辦maven打包等工具的使用。 查看系統的jdk版本…

學英語要用計算機嗎,學計算機的人是否要學英語?

我記得在我大一的時候,那個時候還沒有程序課呢.不過我是很喜歡計算機這個專業的,我也非常想學習編程語言,所以當時即使沒有程序課,我也是借了一本VB的書回家來看.當時就在VB的貼吧亂看,大概貼吧里有一個人氣很高的一位高手,寫了好多文章,也幫人解決好多問題.在他的觀點中,他認為…

語言之輸出png圖片_什么是PPML?如何輸出PPML文檔?

什么是PPML?PPML是由PODi聯盟的幾個會員公司共同開發出一種個性化印刷標識語言,這是一種全新的、基于XML(可擴展標識語言)技術的印刷行業標準語言,得到越來越多的業內人士關注。PPML采用XML作為句法基礎,使PPML其他很多…