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 trialMario Ocampo
192 PointsIn Quiz question 3 of 4 "Which code would take the number 3.14 and coerce it into a float? Isn't this already a fpn?
Because 3.14 is not an int since ints are whole numbers and 3.14 has a decimal therefore it is already a floating point number (float). Shouldn't the question instead ask which code would take the float 3.14 and coerce it into an int? Therefore the correct answer should be int("3.14")
1 Answer
Rohald van Merode
Treehouse StaffHey Mario Ocampo 👋
You're right about ints being whole numbers and the decimals indicating a float. This quiz question however asks to convert a string to a float. Since the "3.14"
is wrapped in quotation marks it indicates that you're working with a string instead of a float 🙂
Hope this clears things up!
Mario Ocampo
192 PointsMario Ocampo
192 PointsHi Ronald,
Oh my, thanks for clearing that up I did not pay close attention to notice the quotations to indicate a string. I'll pay close attention to the questions next time especially because something as simple as quotation marks can make an impact to the code.