Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics Types and Branching Numeric

why this script don't work

x = input(" Enter the first number : " )

y = input(" Enter the secound number : ")

float(x)

float(y)

print("The result : ", x + y)

3 Answers

Kent ร…svang
Kent ร…svang
18,823 Points

You need to store the value returned by float() into a variable.

    first_number = float(x)
    second_number = float(y)

and if you are going to use comma-separated values in your print-function you can remove the placeholder {}

Gideon De Villiers
PLUS
Gideon De Villiers
Courses Plus Student 632 Points

x = float(input('Enter the first number ')) y = float(input('Enter the second number '))

print('The Result:', x+y)

Richie Sanchez
Richie Sanchez
1,837 Points

a more convoluted way (if I understood the desired output correctly):

x = input("Enter the first number: ") y = input("Enter the second number: ")

print("The result is:",float(int(x) + int(y)))

Output in Shell: 11.0