Reading a series of input / output in Python

Posted by PulpFiction on Stack Overflow See other posts from Stack Overflow or by PulpFiction
Published on 2010-05-22T10:47:50Z Indexed on 2010/05/22 11:00 UTC
Read the original article Hit count: 152

Filed under:

Hello everyone.

For my app, I need to print out a series of outputs and then accepts inputs from the user. What would be the best way of doing this?

Like:

print '1'
x = raw_input()

print '2'
y = raw_input()

Something like this, but it would go on for at least 10 times. My only concern with doing the above is that it would make up for poor code readability.

How should I do it? Should I create a function like this:

def printOut(string):
   print string

Or is there a better way?

© Stack Overflow or respective owner

Related posts about python