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 trialilyass el fatimy
Courses Plus Student 117 Pointswhy 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
18,823 PointsYou 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
Courses Plus Student 632 Pointsx = float(input('Enter the first number ')) y = float(input('Enter the second number '))
print('The Result:', x+y)
Richie Sanchez
1,837 Pointsa 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