Make this code more efficient numb = int(input("What is your favourite number? ")) name = str(input("What is your name? ")) if numb == 7 and name != ("David"): print ("correct number, wrong name! you...



Make this code more efficient


numb = int(input("What is your favourite number? "))

name = str(input("What is your name? "))


if numb == 7 and name != ("David"):

    print ("correct number, wrong name! you silly bean!!!!")

elif numb !=7 and name == ("David"):

    print ("Right name, wrong number")

elif numb ==7 and name ==("David"):

    print ("got'em both!")

elif numb != 7 and name != ("David"):

    print ("neither")


else:
    print("zzzzzz")



We have usedNOT with theAND statements to get what we want as a response. Is there a more efficient way of coding this program?



Make the above code more efficient


Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here