Seven Python Math Library Functions ๐Ÿงฎ ๐Ÿ

A beginner should know about these important functions, it will make your work easy!!

Thread ๐Ÿ˜๐Ÿงต Image
1โƒฃ ๐˜€๐—พ๐—ฟ๐˜

In python, to find the square root of any number ( 3 is the square root of 9 ) you don't have to use power operator.

There is a special function " sqrt " which square roots the number given it as a parameter :)

๐Ÿ”— Code Image
2โƒฃ ๐—ฝ๐—ผ๐˜„

In the above tweet, we have learned how to square root a given number.

A square root is actually a number raised to a power of 0.5

But what if we want 3 or something as power.

Here we use " pow(x,y) " it returns x raised to power y.

๐Ÿ”— Code Image
3โƒฃ ๐—ฐ๐—ฒ๐—ถ๐—น

ceil function in python is used to return the smallest integer greater than equal to the given number.

For ex- ceil(9.1) = 10 , ceil(9.0) = 9

๐Ÿ”—Code Image
4โƒฃ ๐—ณ๐—น๐—ผ๐—ผ๐—ฟ

floor function in python returns the largest integer smaller than or equal to the given number.

For ex- floor(9.9) = 9 , floor(9.1) = 9

๐Ÿ”— Code Image
5โƒฃ ๐—ณ๐—ฎ๐—ฐ๐˜๐—ผ๐—ฟ๐—ถ๐—ฎ๐—น

Yes, you read it correctly!!

You don't have to write a program for finding the factorial of a number.

It's just one line of code ;)

๐Ÿ”— Code Image
6โƒฃ ๐—ถ๐˜€๐—ป๐—ฎ๐—ป

While doing analysis of data of 1000s of entries, sometimes we have to check that which entry is empty or NaN ( Not a number)

To check this math library have " isnan " function.

It returns true if x is a NaN otherwise returns False!

๐Ÿ”— Code Image
7โƒฃ ๐—ฒ๐˜…๐—ฝ

In mathematical calculations, sometimes we have to find exponential of some number.

Don't worry you don't have to do calculations in python ;)

There is a simple function exp, which take number as input and gives the result!!

๐Ÿ”—Code Image
Hey all,

Hope you are learning something new from my threads daily.

If you like my content then please ReTweet the first tweet of the thread so that it can be reached to your connections too ๐Ÿ˜‰

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Saurav Jain

Saurav Jain Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Sauain

14 Jul
๐—›๐—ฎ๐—ฎ๐—ฟ ๐—–๐—ฎ๐˜€๐—ฐ๐—ฎ๐—ฑ๐—ฒ๐˜€๐Ÿ‘จโ€๐Ÿ’ป

- Arguably OpenCVโ€™s ( Open source Computer Vision ) most popular object detection algorithm.

-What is it?
-Algorithm
-Limitation
-Applications

A BIG Thread ๐Ÿงต๐Ÿ‘‡ Image
We are living in an era, where object detection is used everywhere.

From security cameras to our mobile phones, it is used everywhere.

Haar classifiers, classifiers were used in the ๐—ณ๐—ถ๐—ฟ๐˜€๐˜ ๐—ฟ๐—ฒ๐—ฎ๐—น-๐˜๐—ถ๐—บ๐—ฒ ๐—ณ๐—ฎ๐—ฐ๐—ฒ ๐—ฑ๐—ฒ๐˜๐—ฒ๐—ฐ๐˜๐—ผ๐—ฟ. Image
๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐—›๐—ฎ๐—ฎ๐—ฟ ๐—–๐—ฎ๐˜€๐—ฐ๐—ฎ๐—ฑ๐—ฒ โ”

Haar Cascade classifiers are an effective way for object detection.

This method was proposed by Paul Viola and Michael Jones in their paper Rapid Object Detection using a Boosted Cascade of Simple Features.
Read 13 tweets
13 Jul
Learn Python while playing games ๐ŸŽฏ

Five Ideas to make a game using Python๐Ÿ

๐Ÿงต
1โƒฃ Dice Roller

Have no dice for your ludo game?

No worries you can create one using Python in just a few minutes.

Just use a random library and make one for yourself๐Ÿ˜‰
2โƒฃ Hangman

You can make this game in Python too ;)

The word to guess is represented by a row of dashes.

If the player guesses a letter that exists in the word, the script writes it in all its correct positions. The player has 10 turns to guess the word.
Read 7 tweets
10 Jul
Five Python Libraries for Machine Learning ๐Ÿ

Thread ๐Ÿงต๐Ÿ‘‡
1โƒฃ ๐—ง๐—ฒ๐—ป๐˜€๐—ผ๐—ฟ๐—™๐—น๐—ผ๐˜„

It is an open-source library created by the Google Brain team.

It is very popular for high-performance numerical computation.

It has an ecosystem of tools, libraries, and community resources for building and deploying powerful ML applications.
2โƒฃ ๐—ž๐—ฒ๐—ฟ๐—ฎ๐˜€

Keras is a deep learning API written in Python, running on top of the machine learning platform TensorFlow.

It is a high-level neural networks API capable of running on top of TensorFlow, CNTK, or Theano.

It can run seamlessly on both CPU and GPU.
Read 7 tweets
9 Jul
How to make a simple Rock, Paper, Scissor game using Python? โœŠ๐ŸคšโœŒ๏ธ

Here in this thread, I will try to make the process easier for you :)

PS - Github link for the project in the last tweet of the thread.

Thread ๐Ÿงต๐Ÿ‘‡ Image
๐—œ๐—บ๐—ฝ๐—ผ๐—ฟ๐˜๐—ถ๐—ป๐—ด ๐—น๐—ถ๐—ฏ๐—ฟ๐—ฎ๐—ฟ๐—ถ๐—ฒ๐˜€

As usual, in every project, the first step is to upload the required libraries for our project

So here we are going to import the random library of python.

Random is widely used to select randomly a choice from all the choices.

๐Ÿ”—Code Image
๐—ง๐—ฎ๐—ธ๐—ถ๐—ป๐—ด ๐—ถ๐—ป๐—ฝ๐˜‚๐˜ ๐—ณ๐—ฟ๐—ผ๐—บ ๐˜‚๐˜€๐—ฒ๐—ฟ

So the next step is to taking input from the user.

The possible choices here are rock, paper, scissors.

We will use the input function to do so.

๐Ÿ”—Code Image
Read 9 tweets
6 Jul
๐—œ๐—ป๐˜๐—ฟ๐—ผ ๐˜๐—ผ ๐— ๐—ฎ๐—ฐ๐—ต๐—ถ๐—ป๐—ฒ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ถ๐—ป๐—ด ๐Ÿ’ก

Let me introduce you to the absolute starting of Machine Learning

-What is ML?
-Its types
-Some real-world applications
๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐— ๐—Ÿ? ๐Ÿ’ป

I have said this earlier too that I have done various ML courses but one of the best definition is from Andrew Ng course-

"Machine learning is the science of getting computers to act without being explicitly programmed."
๐—ง๐˜†๐—ฝ๐—ฒ๐˜€ ๐—ผ๐—ณ ๐— ๐—ฎ๐—ฐ๐—ต๐—ถ๐—ป๐—ฒ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ถ๐—ป๐—ด

-Supervised
-Unsupervised
-Reinforcement
-Semi-supervised
Read 9 tweets
5 Jul
5 Free Courses/Sites for Beginners to learn Python ๐Ÿ’ป

๐Ÿงต๐Ÿ‘‡
1โƒฃ ๐—น๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ฝ๐˜†๐˜๐—ต๐—ผ๐—ป .๐—ผ๐—ฟ๐—ด

The best way to learn python is to read docs and do the hands-on.

And this site is perfect to get started with python.

This site is supported by Datacamp.

๐Ÿ”—learnpython.org Image
2โƒฃ ๐—œ๐—ป๐—ณ๐˜†๐—ง๐—ค

This learning platform is created by one of India's topmost tech company Infosys.

If you are planning to learn python in deep, you should start with InfyTQ courses for python.

You should start with Foundation courses.

๐Ÿ”—infytq.onwingspan.com/en/page/home Image
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(