所以我基本上正在开发一个项目,在这个项目中,计算机从一个单词列表中取出一个单词并为用户弄乱它.只有一个问题:我不想继续在列表中写出大量的单词,所以我想知道是否有办法导入大量的随机单词,所以即使我不知道它是什么,并且然后我也可以享受游戏了?这是整个程序的编码,它只有6个单词,我输入:
import random
WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone")
word = random.choice(WORDS)
correct = word
jumble = ""
while word:
position = random.randrange(len(word))
jumble += word[position]
word = word[:position] + word[(position + 1):]
print(
"""
Welcome to WORD JUMBLE!!!
Unscramble the leters to make a word.
(press the enter key at prompt to quit)
"""
)
print("The jumble is:", jumble)
guess = input("Your guess: ")
while guess != correct and guess != "":
print("Sorry, that's not it")
guess …
Run Code Online (Sandbox Code Playgroud) 我需要在Ubuntu Linux 12.04上安装python的一些模块.我想要pygame和livewires,但我不知道如何安装它们.
我有livewires的py文件,它已被特别编辑(从我正在阅读的书中)我想安装它但我不知道如何,我也想安装pygame.
我制作了一个我用 Python 制作的游戏的 .exe 文件,但我不知道如何让该 exe 文件有一个图标,因为它看起来沉闷无聊。我想以某种方式使图标成为小行星的图片,比方说,因为我制作了游戏小行星。我使用 cx_freeze 来编译它。
python ×3
python-3.3 ×2
cx-freeze ×1
exe ×1
icons ×1
linux ×1
package ×1
python-3.x ×1
random ×1
ubuntu ×1