Learn to play with numbers in Python

avatar

py 3 num.JPG

In order to become an expert in whatever you do, it is best to practice it on a daily basis and the same is true of Python too.

It is best to use Google colab if you are just starting out and do not want to download the entire library.

The screenshot shows how simple calculations are done in Python.

Python is easier to learn especially if you are a beginner and want to learn how to code without becoming confused by all of the tech stuff.

Try these out and see if you get it right. The errors that do occur are mostly because of indentation, in Python.

py num 3a.JPG

In the first case, the maximum value is written down
and in the second print, min returns the minimum value
The round command rounds off a decimal to the nearest. So, 2.3 is 2 and 2.8 is 3.

python 3b.JPG

from math import * - This helps you to use math functions easily.

So, sqrt means square root and sqrt of 36 is shown as 6.0 in the screenshot above.

The floor gives you the lesser among the two and so shows the result as 3.
The ceil gives you a higher value and this gives input as 4.

images - screenshots

I hope you find these useful.



0
0
0.000
1 comments
avatar

Congratulations @filler! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published a post every day of the week

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

SteemFest⁴ - Meet the Steemians Contest
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
0
0
0.000