Question : Input after all prompts in python

Bart bc at freeuk.com
Tue Jun 12 07:37:15 EDT 2018


On 11/06/2018 12:16, Steven D'Aprano wrote:
> On Mon, 11 Jun 2018 01:44:19 -0700, mohan4h wrote:
> 
>> Everyone,
>>
>> I am very new to python. I am trying to achieve the below in it, but i
>> am unable to find suitable documentation to guide me on the same.
>>
>> I want to prompt 3 questions together and then get input for the first
>> question next to question as below.
>>
>> 1. Enter your name : _
>> 2. Enter your age :
>> 3. Enter your gender :
>>
>> After showing the below prompts, the cursor waits in first question for
>> an input.
> 
> How else do you expect to tell the three inputs apart?
> 
> But okay.
> 
> 
> print("1. Enter your name :")
> print("2. Enter your age :")
> print("3. Enter your gender :")
> name = input("")
> age = input("")
> gender = input("")

This will do the job, eventually:

print("1. Enter your name :")
print("2. Enter your age :")
print("3. Enter your gender :")
name = input("")
age = input("")
gender = input("")

print("1. Enter your name :",name)
print("2. Enter your age :",age)
print("3. Enter your gender :",gender)

-- 
bart



More information about the Python-list mailing list