endprog =“start” 而endprog!=“退出”:
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."''')
这会询问号码,我会输入号码,但之后只会一遍又一遍地询问号码
答案 0 :(得分:2)
我怀疑问题出在你的while循环中 - if和elsif块不在你的while循环的范围内。
在纠正那些if,elsif条件之后,以下代码适用于我
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."''')