网上的单词猜谜都是英文的,不会英语的头痛
于是,我把《单词猜谜》改成中文,并且加上了点新功能:
import random as rdm c = rdm.randint(1, 3) name1 = input("你的名字叫什么?:") if c == 1: turns1 = 15 print(f"你很幸运{name1}你有15次机会") elif c == 2: turns1 = 10 print(f"运气不错{name1}你有10次机会") elif c == 3: turns1 = 5 print(f"糟糕透了{name1}你只有5次机会") words1 = ['Donkey', 'Aeroplane', 'America', 'Program', 'Python', 'language', 'Cricket', 'Football', 'Hockey', 'Spaceship', 'bus', 'flight'] word1 = rdm.choice(words1) guesses1 = '' while turns1 > 0: failed1 = 0 for char in word1: if char in guesses1: print(char) else: print("_") failed1 += 1 if failed1 == 0: print("你赢了!!!") print("正确的单词是: ", word1) break guess1 = input("输入你猜的单词:") guesses1 += guess1 if guess1 not in word1: turns1 -= 1 print("猜错啦!") print("你还能猜", + turns1, '次') if turns1 == 0: print("你输了。。。")
直接复印过去就可以玩了
(求赞🥺)