Home > Mobile >  What is the way to add a text after user input while user adding it in the input? In Python
What is the way to add a text after user input while user adding it in the input? In Python

Time:12-29

I would like to make ask the user for any data and put a text after the user input in the execution like below

Number of Persons = input("How many persons?")

Console: ((the Screen to be in same step user adding the answer:))

And How many persons? 5 Persons

CodePudding user response:

From How to print at the same line of an input?

That will display How many persons? 1234 persons after pressing enter

text = "How many persons? "
nb_person = int(input(text))
print(f"\33[1A\33[{len(text)   len(str(nb_person))}C persons")
  • Related