Do you know THIS about round() in Python??? 🤔

preview_player
Показать описание
Everyone knows the round function, but do you know we can use negative values as argument?

Get my Free NumPy Handbook:

📓 ML Notebooks available on Patreon:

If you enjoyed this video, please subscribe to the channel:

~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

#Python #shorts
Рекомендации по теме
Комментарии
Автор

Ugh. And there I was using some fancy % operation like a chump.

deemon
Автор

This is why I love python, been doing it daily for 5 years but still learn new ways of doing things. I also love the changes that are brought in with minor version changes

mwmm
Автор

Another trick too, f"{val:.2f}", this will round to the two numbers after decimal point or what ever number u want

xjx
Автор

"We all know that you can use a second argument in the round function-"
"I DIDN'T!"
thanks lol

grantpeterson
Автор

And there I was three days ago writing a function doing this exact thing but with ceil. And I knew there was something like this already but maybe it doesn't work with math.ceil / floor

Victor_Marius
Автор

Thanks for sharing! I love sticking on your videos with The unexplored technicalities in python.

blueboi
Автор

It's also can be applied on matlab. Same syntax too

calculusIsFuN
Автор

Awesome i didn't know that sir we want more tricks like this

saitejam
Автор

Try doing
round(0.5)
Then
round(1.5)
Have fun learning about this little feature in Python 😉

total_dk
Автор

I wish Python gave access to all the rounding modes prescribed by IEEE754.

In the meantime, there is pyfenv ...

lawrencedoliveiro
Автор

What's the name of that theme? Looks good

Redyf
Автор

What I want built into a language is round to the nearest _. Not the decimals after. Being able to round to an arbitrary number helps a lot with grid operations.

cerulityk
Автор

I was just using the round function one day and got curious if it would give me an error if I tried and negative. I was pleasantly surprised when I saw that it did this

IAmzColbz
Автор

This was helpful, thanks. More videos like this please :)

labscience
Автор

That's so cool, I'm sure this'll come in handy at some point

spencerlawrence
Автор

Cool. What happens is I pass a complex number?

rondamon
Автор

I wish it had a 3rd parameter where you could specify the base or radix

Rudxain
Автор

I didn't know it go negative at least.

UsernameH
Автор

My request to you make a video that how to create a function that will make a newfolder using os module, if already exist then new folder 2 and then 3 or like this . Please short video No problem, I just couldn't finding this idea, and I am new in python.

innocent
Автор

yes i used it for my last project, it's a lifesaver tbh

lolbor