Reputation: 11
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
Upvotes: 0
Views: 3686
Reputation: 317
You can do
print("Some string: " + variable) # Add a whitespace at the end of your string
if you have string with variable or
print(variable1 + ' ' + variable2)
If you need space between 2 variables or use \n
if you need to make a newline
Upvotes: 0
Reputation: 61
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
Upvotes: 1