【发布时间】:2020-10-25 07:48:50
【问题描述】:
import math
number = input('Your Number: ')
ways = input('sin/cos/tan: ')
try:
problem = ways(number)
answer = math.problem
print(f'The value of {ways} of {number} is: {problem}')
这是我的代码。
我想在 python 中使用数学模块解决三角函数,但每次运行它都会给我一个错误SyntaxError: unexpected EOF while parsing
【问题讨论】:
-
ways是字符串,不是函数 -
try不能没有伴随的except声明 -
那我能做什么,把它转换成函数
-
我认为可变ways是字符串类型..你可以使用if else语句,并检查如果ways == sin,使用sin,同样......
标签: python python-3.x trigonometry