我在我的树莓派上做了一个基本的随机程序,它有点像这样。
import random
print ("Welcome to the PC Expo's new game, PC Dispenser, what will you win?")
WinorLose = random.randint(1, 1000)
if WinorLose <100:
print ("You won a Nintendo Wii.")
elif WinorLose >200:
print ("You won a Sony PSP.")
elif WinorLose > 300:
print ("You won a Nintendo Wii U.")
elif WinorLose > 400:
print ("You won a Sony PS Vita.")
else:
print ("Not your lucky day, Try again.")
print ("Thank you for the visit.")
如果您不知道它的作用,它有机会为您提供虚拟 PSP、Wii U 等。但它所做的只是打印“你赢得了索尼 PSP”或“不是你的幸运日,再试一次”。怎么了?有什么修复吗?