-2

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

Saoud ElTelawy
  • 197
  • 1
  • 3
  • 15
  • Why have you not addressed the original reasons for closure and decided to repost from your earlier question…? [What is the way to add a text after user input?](https://stackoverflow.com/questions/70509353/what-is-the-way-to-add-a-text-after-user-input) Please don’t duplicate questions (it’s not permitted here) and instead edit your original question to address the reasons for closure and queue it for reopening. At the very least, can you address why any of the answers that were left on your original question don’t solve your issue? – esqew Dec 28 '21 at 18:06
  • 1
    Try ```print('How many persons? ', end='')``` and then `number_of_persons = input()` followed by ```print('Persons')``` if what you are trying to achieve is just adding a text after the input. – COOL_IRON Dec 28 '21 at 18:13
  • Actually it is obvious that I need support as I don't need to use print ... I just want to add a word beside the user input while he adding it. like Input("How much money to pay?") and the console to be like ..... Dollars – Saoud ElTelawy Dec 28 '21 at 18:19
  • Note that the answer I gave you, came from a post given in comment of your previous question, I just followed the link and try – azro Dec 28 '21 at 18:21

1 Answers1

1

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")
azro
  • 53,056
  • 7
  • 34
  • 70