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 (2015) Logic in Python Try and Except

What's a float and how do you use it?

please help i am not sure what a float is and i need to understand it to pass this task.

trial.py
def add(cool, nice):
    return cool. + nice

2 Answers

Ben Reynolds
Ben Reynolds
35,170 Points

A float is a floating point number, which just means it has a decimal as opposed to an int which is always a whole number with no decimal.

To convert (cast) something to a float would look like this:

num = 10
num_to_float = float(num)
Sneha Nagpaul
Sneha Nagpaul
10,124 Points

So, you probably don't need to know what floats are for this task. Just remove the full stop(period) from after cool. You should be good to go.