Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Python have a whole number data type?

Tags:

python

I have a question: Does python have a whole number data type> Unlike integers and floats, whole numbers are non-negative (0 to infinity). Does python have a data type declaration for that?

like image 695
Chrisyantar Hasiholan Avatar asked Nov 24 '25 12:11

Chrisyantar Hasiholan


1 Answers

No, it doesn't have such a number as a native type. You could use int, and just never store a negative number. Or you could create your own type and limit its value in its methods.

like image 56
Robᵩ Avatar answered Nov 27 '25 02:11

Robᵩ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!