博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python函数示例_带Python示例的complex()函数
阅读量:2538 次
发布时间:2019-05-11

本文共 1528 字,大约阅读时间需要 5 分钟。

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() functionreal = 10img  = 20# complex number  by passing real numberprint(complex(real))# complex number  by passing real & img. numberprint(complex(real, img))# complex number by passing real part as 0print(complex(0))# complex number by passing real and img. part as 0, 0print(complex(0,0))# with float valuesreal = 10.23img  = 20.45# complex number  by passing real numberprint(complex(real))# complex number  by passing real & img. numberprint(complex(real, img))

Output

输出量

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

翻译自:

python函数示例

转载地址:http://muxzd.baihongyu.com/

你可能感兴趣的文章
小D课堂 - 新版本微服务springcloud+Docker教程_6-01 微服务网关介绍和使用场景
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_5-05熔断降级服务异常报警通知
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_6-03 高级篇幅之zuul常用问题分析
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_5-08 断路器监控仪表参数
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_6-02 springcloud网关组件zuul
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_2-1.快速搭建SpringBoot项目,采用Eclipse...
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_1-4.在线教育后台数据库设计...
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_2-3.热部署在Eclipse和IDE里面的使用...
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_1-3.在线教育站点需求分析和架构设计...
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_2-4.后端项目分层分包及资源文件处理...
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_2-2.快速搭建SpringBoot项目,采用IDEA...
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_3-5.PageHelper分页插件使用
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_5-6.微信扫码登录回调本地域名映射工具Ngrock...
查看>>
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_5-8.用户模块开发之保存微信用户信息...
查看>>
Linux下Nginx安装
查看>>
LVM扩容之xfs文件系统
查看>>
Hbase记录-client访问zookeeper大量断开以及参数调优分析(转载)
查看>>
代码片段收集
查看>>
vue-cli3创建项目时报错
查看>>
输入1-53周,输出1-53周的开始时间和结束时间
查看>>