类型错误:必须是实数,而不是s

2024-05-29 10:37:51 发布

您现在位置:Python中文网/ 问答频道 /正文

每当我运行代码时,都会显示错误消息“TypeError:必须是实数,而不是str”

from math import*

num1 = input("Enter the num ")
num2 = input("Enter the power ")

def exponent_func( num1 ,  num2):
     return(pow ( str(num1) , str(num2) ))  

exponent_func(num1 ,  num2)

Tags: the代码from消息input错误mathfunc

热门问题