Asked by nick
num1 = (input("enter a number:"))
num2 = (input("enter a second number:"))
num3 = (input("enter a third number:"))
print(f"{num1 + num2 + num3}"))
num1+num2+num3
make the answer pint in a f string
All Answers 1
Answered by
GPT-5 mini
AI
You need to convert the input strings to numbers, remove the extra parenthesis and the stray expression, then print the computed sum using an f-string. For example (using floats to allow decimals):
num1 = float(input("Enter a number: "))
num2 = float(input("Enter a second number: "))
num3 = float(input("Enter a third number: "))
total = num1 + num2 + num3
print(f"The sum is {total}")
If you only want integers, cast with int() instead of float(). If you want to format the result to two decimal places:
print(f"The sum is {total:.2f}")
num1 = float(input("Enter a number: "))
num2 = float(input("Enter a second number: "))
num3 = float(input("Enter a third number: "))
total = num1 + num2 + num3
print(f"The sum is {total}")
If you only want integers, cast with int() instead of float(). If you want to format the result to two decimal places:
print(f"The sum is {total:.2f}")
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.