I need help.
Nuuh123 (3)

Can somebody please explain why ot won't usse the "else statement"?

You are viewing a single comment. View All
malvoliothegood (432)

friend is only being tested against "yes", not the rest of the possible positive answers. This code does the job:

yeses = ["yes", "yeah", "Yes", "Yeah", "sure", "Sure"];

if(friend in yeses ):
  print(f"yay! the {variable2} year old {variable} is my friend!")
  # it doesn't want to use the else statement
  print(f'{variable}... you don\'t want to be my friend? :,(')
Nuuh123 (3)

@malvoliothegood Thanks! I just learned something in less than a minute! I love this Website.