-2

How to delete an empty line after using input() in python.

annual_salary =  int(input("Enter your annual salary:"))
portion_saved = float(input("Enter the percent of your salary to save, as a decimal:"))
ZiGaelle
  • 744
  • 1
  • 9
  • 21
  • What do you mean by *delete an empty line*? – Tomerikoo Jul 21 '19 at 13:14
  • When it is asking input after giving input am getting a blank line. You can run the code. – ajay kumar Jul 21 '19 at 13:24
  • 1
    Possible duplicate of [Possible to get user input without inserting a new line?](https://stackoverflow.com/questions/7173850/possible-to-get-user-input-without-inserting-a-new-line) – ArendE Jul 21 '19 at 14:32

1 Answers1

0

I'm unsure what you are asking, the code seems to work fine without an empty line:

output

Read up the documentation about input(): https://docs.python.org/3/library/functions.html#input

input([prompt])

If the prompt argument is present, it is written to standard output without a trailing newline.

So if you do not want an empty line, make sure to add in a prompt.

See Possible to get user input without inserting a new line? if your issue is the newline after people inserted a value.

ArendE
  • 957
  • 1
  • 8
  • 14