Discuss / Python / 求大神。。。

求大神。。。

Topic source

不知道怎么办了。。。 Frequency = input('Frequency =') print('Period =', 1/Frequency)

一运行就TypeError: unsupported type(s) for /: 'int' and 'str'

sunna67089

#2 Created at ... [Delete] [Delete and Lock User]

kkk

sunna67089

#3 Created at ... [Delete] [Delete and Lock User]

Frequency is a string for example, if you input 10, then Frequency = '10' so Period = 1 / '10'. that is wrong. you should convert Frequency into int. like this 1/int(Frequency).

感谢


  • 1

Reply