Most popular tags

306 questions

415 answers


329 users

Most active Members
this week:

    My Code isn't working.

    +1 vote

    So here is my code so far:

    name = input ("what is your name?")

    print ("Hello" , name)
    feeling = input ("Are you feeling good or bad?")
    if feeling ==("good"):
        print ("oh that's great!")
    if feeling ==("bad"):
        print ("that's terrible!")
    if not feeling ==("good,bad"):
        print ("i said can you put good or bad...")
    birthday = input ("So how old are you?")
    print (birthday,"?")
    Everything works, but if i type in good or bad into the second input, it says:
    oh that's great!
    i said can you put good or bad...
    What I was wondering is, how do i get it so it doesn't say 'i said can you put good or bad...' if you input good or bad?
    asked Sep 22, 2016 in Python by anonymous
    edited Sep 22, 2016 by anonymous

    1 Answer

    0 votes

    if not feeling ==("good,bad"):

    this might be the problem line.   So to check for not equals try

    if feeling <> "(good bad"):

    answered Sep 22, 2016 by smartin (10,770 points)
    Welcome to Selby Computing Q&A, where you can ask questions and receive answers from other students in Computer Science.