2024-09-30 16:35:28 发布
网友
我想用python创建一个特殊的计算器,但是要做到这一点,我应该了解更多关于复数的知识。我的计算器必须得到一个字符串并输出复方程。请帮帮我。在
myinput = "5 + 2j" myoutput = ConvertToComplex(myinput) * (3 + 12j) #please help me with writing this function print(myoutput)
您要查找的函数已经内置到python中了。你只需要先去掉空格:
myinput = "5 + 2j" mycleaninput = myinput.replace(" ","") myoutput = complex(mycleaninput) * (3 + 12j) print(myoutput)
您要查找的函数已经内置到python中了。你只需要先去掉空格:
相关问题 更多 >
编程相关推荐