How do I do this?????????
i'm doing this code where the user inputs a string and I want to write a code where if the string the user typed string is not one of the words "title" "director" or "year" it would print "error", how would I do this?
text = input("type something: ") if text not in ("title", "director", "year"): print("ERRROR!!!!!!! aeouheorceaouhrceaodroclidrcoeuhildrocecrhuraeohirlcoehauoaeua")
ah a panicking program.
Anyways, you'll first need an input to get something from the user. Then, use conditionals to determine if what the user is said is equal to those words. Then, if yes, output 'error'.
Try to do it first, and if you're stuck check this out (assuming it's Python):
user_input = input("Say something ") # the input if user_input == "something": # conditionals print("Error") # output
And replace what you don't need with what you desire.
Lemme know if you have any questions! :D