第 5 步:让我们在提示中添加更多单词,以便玩家了解提示是什么。
由于password_length存储的是一个数字,我们必须将它放在str()中以将其转换为字符串。
请记住,+ 号可以让我们加入字符串!精灵现在说“提示:单词中有 6 个字母!”
- 在已经存在的变量之前和之后添加这些字符串。 say()使完整的参数看起来像这样! "Hint: there are " + str( password_length ) + " letters in the word!"
To navigate the page using the TAB key, first press ESC to exit the code editor.