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:"))
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:"))
I'm unsure what you are asking, the code seems to work fine without an empty line:
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.