Search code examples
pythonwhitespace

How do add whitespace in between a word in python


Hi I am a newbiew learning python and i have a very simple question and can't seem to work it out.

I have built this little program and i was just wondering one thing.

print("Hello Sir !!!")
num1 = input("Enter a number: ")
num2 = input("Enter another Number: ")
result = float(num1) + float(num2)
print(result)
num3 = input("Enter your final Number: ")
result = float(num3) / (float(num1) + float(num2))
print("Your final total is:", result)
print("You are now finished")
print("Have an Amazing day!! ")

RESULT = Hello Sir !!! Enter a number: 50 Enter another Number: 50 100.0 Enter your final Number: 5 Your final total is: 0.05 You are now finished Have an Amazing day!!

Process finished with exit code 0

If i wanted to write "Your final total is:0.05" or "Your final total is:
0.05"

How would i move it closer or further away?

Thank you for your help today


Solution

  • If you want to add more whitespaces, you can just added it inside the string. If you want a new line, you can use "\n" in your string, which indicate the start of a new line.

    Check this link to find out more about escape characters:

    https://www.tutorialspoint.com/escape-characters-in-python