+1

How many bytes are used for numeric variables in Python?

For example, in this code: https://code.sololearn.com/cAusnEKMKgaK/?ref=app

2/16/2020 10:09:55 PM

Sonic

1 Answer

New Answer

+2

You can use sizeof operator to find it out. You can either import getsizeof method from the sys module: from sys import getsizeof print(getsizeof(20)) #Prints the sizeof the integer 20. Objects should also have a magicmethod, might be discouraged from using, but works: print((20).__sizeof__()) Remember that you would sometimes need parentheses, for example 20.__sizeof__() would result in errors, with variables this doesn't cause problems: a = 20 print(a.__sizeof__())