0

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

0

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.