123.0\r\n-12.0<\/pre>\n\u590d\u6570\u7684\u5185\u5efa\u5c5e\u6027\uff1a<\/p>\n
\u590d\u6570\u5bf9\u8c61\u62e5\u6709\u6570\u636e\u5c5e\u6027\uff0c\u5206\u522b\u4e3a\u8be5\u590d\u6570\u7684\u5b9e\u90e8\u548c\u865a\u90e8\u3002<\/p>\n
\u590d\u6570\u8fd8\u62e5\u6709 conjugate \u65b9\u6cd5\uff0c\u8c03\u7528\u5b83\u53ef\u4ee5\u8fd4\u56de\u8be5\u590d\u6570\u7684\u5171\u8f6d\u590d\u6570\u5bf9\u8c61\u3002<\/p>\n
\u590d\u6570\u5c5e\u6027\uff1areal(\u590d\u6570\u7684\u5b9e\u90e8)\u3001imag(\u590d\u6570\u7684\u865a\u90e8)\u3001conjugate()\uff08\u8fd4\u56de\u590d\u6570\u7684\u5171\u8f6d\u590d\u6570\uff09<\/p>\n
#coding=utf8\r\n\r\nclass Complex(object):\r\n '''\u521b\u5efa\u4e00\u4e2a\u9759\u6001\u5c5e\u6027\u7528\u6765\u8bb0\u5f55\u7c7b\u7248\u672c\u53f7'''\r\n version=1.0\r\n '''\u521b\u5efa\u4e2a\u590d\u6570\u7c7b\uff0c\u7528\u4e8e\u64cd\u4f5c\u548c\u521d\u59cb\u5316\u590d\u6570'''\r\n def __init__(self,rel=15,img=15j):\r\n self.realPart=rel\r\n self.imagPart=img\r\n \r\n #\u521b\u5efa\u590d\u6570\r\n def creatComplex(self):\r\n return self.realPart+self.imagPart\r\n #\u83b7\u53d6\u8f93\u5165\u6570\u5b57\u90e8\u5206\u7684\u865a\u90e8\r\n def getImg(self):\r\n #\u628a\u865a\u90e8\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\r\n img=str(self.imagPart)\r\n #\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u5207\u7247\u64cd\u4f5c\u83b7\u53d6\u6570\u5b57\u90e8\u5206\r\n img=img[:-1] \r\n return float(img) \r\n \r\ndef test():\r\n print \"run test...........\"\r\n com=Complex()\r\n Cplex= com.creatComplex()\r\n if Cplex.imag==com.getImg():\r\n print com.getImg()\r\n else:\r\n pass\r\n if Cplex.real==com.realPart:\r\n print com.realPart\r\n else:\r\n pass\r\n #\u539f\u590d\u6570\r\n print \"the religion complex is :\",Cplex\r\n #\u6c42\u53d6\u5171\u8f6d\u590d\u6570\r\n print \"the conjugate complex is :\",Cplex.conjugate()\r\n \r\nif __name__==\"__main__\":\r\n test()<\/pre>\n","protected":false},"excerpt":{"rendered":"Python \u8bed\u8a00\u4e2d\u6709\u5173\u590d\u6570\u7684\u6982\u5ff5\uff1a \u865a\u6570\u4e0d\u80fd\u5355\u72ec\u5b58\u5728\uff0c\u5b83\u4eec\u603b\u662f\u548c\u4e00\u4e2a\u503c\u4e3a 0.0 \u7684\u5b9e\u6570\u90e8\u5206\u4e00\u8d77\u6784\u6210\u4e00\u4e2a\u590d\u6570 […]<\/p>\n","protected":false},"author":321,"featured_media":219097,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-219095","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/219095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/321"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=219095"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/219095\/revisions"}],"predecessor-version":[{"id":219100,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/219095\/revisions\/219100"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/219097"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=219095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=219095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=219095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}