For my code, I'm making an if
statement typically an if
statement that contains two if
conditions. Look at the third line of code with hashtags beside it to understand what i'm asking
Look at the hashtags to understand my question. Parts where hashtags are beside are to either indicate that its related to my question or contains my question.
random1 = ["cool"]
random2 = ["wicked"]
import random
message = random.choice(random1 + random2) #######
print(message)
if message in random2: #######
question = input("\ny/n ==> ") #######
if (question == "y"):
print("hello")
elif (question == "n"):
print("what")
elif message in random1:
print("lets go")
elif something in black and white in red:
print("green")
if (question == "n"): ###### (SINCE THE QUESTION CAN OCCUR OR NOT
###### OCCUR, HOW DO I MAKE AN IF STATEMENT ALONG
###### WITH THE STATEMENT WHEN THE USER SELECTS
###### "N" For example "if (question == "n" and
###### question does not exist)
print("bye")
if (question == "y"):
print("pink")
Response to "This question may already have an answer here: Determine if variable is defined in Python"
My question is not a duplicate of the suggested post. I am not asking how to figure out if a variable is defined or not. I want to simply make a double if statement which includes one condition of when the user selects "n" and another condition of when the variable "question" does not exist, since "question" can randomly appear or not appear