So I'm trying to get this function to return what I write only if it is equal to a character in an array. If not I want it to keep looping.
def pick():
picks = input('Type one letter. ')
choice = {'q', 'w', 'e', 'r', 't', 'y'}
for x in choice:
while x in choice != picks:
picks = input('Pick again. ')
else:
return x
pick()
I am just getting really confused with this.
Example:
Type one letter. z
Pick again. q
then it will return q to the function to be used in another function.
Also It has to only continue to the next function if this one is right (returns the proper character). The other function while compare this functions answer to its own. Will it stop other functions from "starting" while this one keeps looping if it is not right?
while x in choice != picks:to do?choiceoutside thepickfunction.