Can we make an initial consonant game with Python?
First of all, I made a code that only subtracts initial consonants from words.
I want to make a game, but what do I do with the code?
python
It's such a basic example, so I think I'll hurt my pride if I make a code for you.
dae_dab = None
jung_dab = 'forsythia';
Hint = get_choseong(jeong_dab) # You can use the code you made.
print("Hint is " + hint + "! What's the answer?")
While Dae_dab is not Jeong_dab : # Unless the answer is correct, it must be
da_dab = input() # Take the input as an answer
print("Correct! The answer is "+jeong_dab+")
import random
def getHint(win):
''' a function that obtains initial consonants from words
'''
return "Hint"
def selectTheme(theme):
if theme == 1:
return plants
elif theme == 2:
return animals
plants = ["Forsythia", "Azalea", "Pine Tree"]
animals = ["Cat", "Tiger", "Lion"]
they = input ("Choose a theme (plant: 1, animal: 2)")
items = selectTheme(theme)
win = items[random.randrange(0,len(items))]
hint = getHint(win)
print ("Hint is " + hint + "")
answer = None
while answer is not win:
answer = input ("What is the answer?")
print ("Congratulations, you got it right")
© 2024 OneMinuteCode. All rights reserved.