pub-3785248829033902 | Python: Import Math for Smokers | - Big data with Python

| Python: Import Math for Smokers |

The Math library has many functions that are useful for programs that need to perform mathematical operations, that cannot be accomplished using the built in operators.


The best way to learn new things is to take a practical approach of the things you want to learn. Here is a fragment of code that demonstrates the use of the Health Calculator statement in Python:

Æ’ python command

import math
def HealthCalculator(age,apples,cigarettes):
    answer = ( (100-age) + (apples*1.3) - (cigarettes*2) )
    print('You will live ' + str(math.trunc(answer))+ ' years!')

John_Smith = [35, 20 ,20]
HealthCalculator(*John_Smith)

output

You will live 51 years!


Previous
Next Post »

1 comments:

Write comments
arjun
AUTHOR
August 1, 2019 at 9:40 PM delete

Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.
Surya Informatics

Reply
avatar