Question : Input after all prompts in python
Karsten Hilbert
Karsten.Hilbert at gmx.net
Mon Jun 11 08:22:24 EDT 2018
On Mon, Jun 11, 2018 at 02:14:26PM +0200, Peter Otten wrote:
> >> print("1. Enter your name :")
> >> print("2. Enter your age :")
> >> print("3. Enter your gender :")
> >> name = input("")
> >> age = input("")
> >> gender = input("")
> >
> > That doesn't solve the "next to" part in
> >
> > get input for the first question next to question
>
> Easy:
>
> def up(n):
> print("\u001b[{}A".format(n), flush=True, end="")
>
> def right(n):
> print("\u001b[{}C".format(n), flush=True, end="")
>
> print("1. Enter your name:")
> print("2. Enter your age:")
> print("3. Enter your gender:")
> up(3)
> right(22)
> name = input("")
> right(22)
> age = input("")
> right(22)
> gender = input("")
>
> If it doesn't work you are using the wrong terminal ;)
Sure, but notice how I said "(easily)" in the original answer ?
The above is NOT easy for an OP who has to ask the original question.
Karsten
--
More information about the Python-list
mailing list