Python-Float Decimal places - Passionate Geekz

Breaking

Where you can unleash your inner geek.

Saturday, 22 June 2019

Python-Float Decimal places

Python used Integers as Float no.’s for example if we divide two no. such as 10/2 output would be 5.0 instead of 5 , dividing any two integers produces a float.

Converting an integer into a float makes the operation more accurate, that’s why python is used in scientific computing

Dividing ALWAYS results in a float,Even if divided perfectly

Computers can’t store reoccurring decimals perfectly.

#Author : Paras Guglani
#Website : Passionategeekz.com
#created : 23/06/2019 00:47am

a=10
b=5
c=(a/b)
print(c)

2.0
[Finished in 0.3s]

Note: We don’t have to declare int or float

 

No comments:

Post a Comment