-1

I am working on a simple display for the result but when I try to put a string and the float is the same line i got an error.

here is the code:

num1 = input('Type a number: \n')
num2 = input('type second number: \n')
res = float(num1) + float(num2)
print('Your result is: ' + res)
moist_wrist3
  • 31
  • 1
  • 11
  • 2
    Does this answer your question? [What is the syntax for printing multiple data types in Python?](https://stackoverflow.com/questions/36906268/what-is-the-syntax-for-printing-multiple-data-types-in-python) – JeffUK Dec 08 '20 at 15:37
  • The Zen of Python notwithstanding, there are several ways to do this. – Fred Larson Dec 08 '20 at 15:37

2 Answers2

2

Try:

print('Your result is: ' + str(res))
Marko
  • 733
  • 8
  • 21
1

This

print("Hello World", 1.45)

For you

print('Your result is:', res)
Faraz
  • 433
  • 3
  • 7