我正在尝试使用python构建一个程序,每当我使用这些elif语句时,它们都无法工作.就像我投入500,freq然后我得到Sorry输出,bad而不是我应该得到.
我究竟做错了什么?
freq = raw_input()
if freq <= "87.10" :
print("Sorry")
elif freq <= "108.10" :
print("bad")
else:
print("good")
Run Code Online (Sandbox Code Playgroud) 我试图在python 2.7中编写一个程序,它必须选择多个随机变量并将其打印出来.但是变量不能与之前打印的任何变量相同.
我一直在寻找谷歌和这个网站,我还没有找到任何字符串(我到目前为止只发现了整数).这是一个例子:
sentences = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p]
print (random.choice(sentences)) + (random.choice(sentences)) + (random.choice(sentences))
>>> a + b + a
Run Code Online (Sandbox Code Playgroud)
我不希望有重复,我希望它是这样的:
>>> a + b + c
Run Code Online (Sandbox Code Playgroud)
有什么办法可以实现吗?