Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

Hi theret Is there any body who can tell me what is the problem in this small python code? or How it should looks like? def eval_loop(): while True: n = raw_input('Enter whatever:\n') if n == 0: break else: return eval('n')

OpenStudy (anonymous):

The return statement at the end should be indented as the 'break' statement

OpenStudy (rsmith6559):

In the return statement, you're evaluating the letter n, not the variable n. Watch the quotes.

OpenStudy (anonymous):

No no no... quotes are fine... that's the syntax of the eval!

OpenStudy (anonymous):

did u forget one of these ; ; ; ; ; ; ; ;

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!