Disclaimer: I am still very new to Python, so if there is an obvious thing that I am missing I apologize, but I couldn't figure it out on my own...
So this is the code I'm working with:
def typeFunct():
userType= str(raw_input())
print(userType)
typeFunct()
def main():
userYn = input("do you wish to type something? (y/n)")
if (userYn == "y" or "Y"):
typeFunct()
if(userYn == "n" or "N"):
print(" ")
main()
So basically I am working with some code and am trying to use a programmer-created function in order to prompt the user into inputting text that is then printed on the screen, however before I use said function, I am first prompting the user as to whether or not they actually want to type anything with a simple "y/n" input that triggers an if
statement:
userYn = input("do you wish to type something? (y/n)")
if (userYn == "y" or "Y"):
typeFunct()
if(userYn == "n" or "N"):
print(" ")
However though testing I found that the code doesn't seem to actually care if the condition of y/n is true or not, it runs both regardless of the condition given, I also tried using an else:
statement:
else:
print(" ")
but still no dice, is there like a glaring error in my programming that I am missing that is making if
statements act like this?