 Introduction to Python

• Status

• # float

So far we have dealt with textual values (`string`s) and integer numbers (`int`s). Yet some applications require dealing with floating-point numbers. In python, those numbers are called `float`s. To read a floating-point number from the input, one can write a simple program:
``````a = int(input())
b = float(input())

print(a, type(a))
print(b, type(b))
print(a + b - 1)``````
In case the inputted numbers were `10` and `7.7`, the program would print the following:
``````10 <class 'int'>
7.7 <class 'float'>
16.7``````

We can define floating-point numbers as regular variables:
``````pi = 3.14159265359
r = 2
print(2 * pi * r)``````
This program would compute the circumference of the circle on the right and would print `12.56637061436`.

#### Challenge

Given two sides of a rectangle `h` and `w`, compute and print its surface area.
 Input Output 2 3 6 1.1 3.5 3.85

Note: You might notice that the python output for the second example is not exactly `3.85` but rather `3.8500000000000005`. That’s because of the way our computers handle floating-point numbers. Watch this video to get more insights into how this magic happens: