Hello all,

I'm very new to programming and Python so please forgive my ignorance. i'm just wondering if it's possible to have two strings on one elif. Something like this.

name = input("What is your full name: ")

if name ==  "Jack Neilson":
    print("I like your name")

elif name == "John Cleese", "Michael Palin":
    print("I don't like your name)

else:
    print("You have a nice name")

Is this possible somehow? Or do I need two elifs for "John Cleese" and "Michael Palin"?

Thank you.

name = input("What is your full name: ").title()

if name in ("John Cleese", "Michael Palin"):
    print("I do not like your name")

elif name == "Jack Neilson":
    print("That's a very nice name")

else:
    print("You have a nice name")
commented: Thank you, works perfectly. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.