0

endprog = "start" while endprog != "exit":

para = int(input("Enter a number 1-9 -> "))

if para == 1:
    print(''' THE ORIGINATOR
1's are originals. Coming up with new ideas and executing them is
natural. Having things their own way is another trait that gets them as
being stubborn and arrogant. 1\'s are extremely honest and do well to
learn some diplomacy skills. They like to take the initiative and are
often leaders or bosses, as they like to be the best. Being
self-employed is definitely helpful for them. Lesson to learn: Others'
ideas might be just as good or better and to stay open minded.
Famous 1's: Tom Hanks, Robert Redford, Hulk Hogan, Carol Burnett, Wynona
Judd, Nancy Reagan, Raque l Welch.''')
elif para == 2:
    print('''" THE PEACEMAKER
2's are the born diplomats. They are aware of others' needs and moods
and often think of others before themselves. Naturally analytical and
very intuitive they don't like to be alone. Friendship and companionship
is very important and can lead them to be successful in life, but on the
other hand they'd rather be alone than in an uncomfortable relationship.
Being naturally shy they should learn to boost their self-esteem and
express themselves freely and seize the moment and not put things off.
Famous 2's: President Bill Clinton, Madonna, Whoopee Goldberg, Thomas
Edison, Wolfgang Amadeus Mozart."''')

this will ask for the number and i will put in the number but after it only asks for number over and over again

4
  • 3
    Please edit the question and format the code correctly :). It also looks like you're missing some code, as you have nothing after elif parra == 3: Commented Oct 10, 2013 at 5:28
  • So is the problem that the while-loop never breaks after printing something? Commented Oct 10, 2013 at 5:39
  • stackoverflow.com/questions/8114355/… Commented Oct 10, 2013 at 5:41
  • the whole code goes to number 9 with a different paragraph for each but the same concept, I deleted the elif statements, typed them back in the same as I had it before, and it magically worked...slightly frustrating lol. Commented Oct 10, 2013 at 5:44

1 Answer 1

2

I suspect the problem is with your while loop - the if and elsif blocks are outside the ambit of your while loop.

After correcting for those if, elsif conditions, the following code works for me

endprog = "start" 

while endprog != "exit":

    para = int(input("Enter a number 1-9 -> "))

    if para == 1:
        print(''' THE ORIGINATOR
1's are originals. Coming up with new ideas and executing them is
natural. Having things their own way is another trait that gets them as
being stubborn and arrogant. 1\'s are extremely honest and do well to
learn some diplomacy skills. They like to take the initiative and are
often leaders or bosses, as they like to be the best. Being
self-employed is definitely helpful for them. Lesson to learn: Others'
ideas might be just as good or better and to stay open minded.
Famous 1's: Tom Hanks, Robert Redford, Hulk Hogan, Carol Burnett, Wynona
Judd, Nancy Reagan, Raque l Welch.''')
    elif para == 2:
        print('''" THE PEACEMAKER
2's are the born diplomats. They are aware of others' needs and moods
and often think of others before themselves. Naturally analytical and
very intuitive they don't like to be alone. Friendship and companionship
is very important and can lead them to be successful in life, but on the
other hand they'd rather be alone than in an uncomfortable relationship.
Being naturally shy they should learn to boost their self-esteem and
express themselves freely and seize the moment and not put things off.
Famous 2's: President Bill Clinton, Madonna, Whoopee Goldberg, Thomas
Edison, Wolfgang Amadeus Mozart."''')
Sign up to request clarification or add additional context in comments.

6 Comments

This does not answer the question. All you did is repeat the user's code and say "I suspect the problem is with your while loop"
@Haidro I took a guess that the user has incorrectly formatted his code. If you read the line this will ask for the number and i will put in the number but after it only asks for number over and over again, it means he was only entering the number, there was no output which meant the while loop had some issues.
Yes, what issues? And how do you fix these issues?
@Haidro The guess was that the if and elsif conditions are outside of the while loop, and that was the issue with his code :) Check this first line endprog = "start" while endprog != "exit": para = int(input("Enter a number 1-9 -> ")) Fixing those issues meant reformatting the code so that the if elsif conditions are within the while loop. As I said earlier, I guessed it from this line of his this will ask for the number and i will put in the number but after it only asks for number over and over again
Okay, that could be a formatting issue with the question, but be sure to edit your answer to reflect this
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.