the int class the int and float classes are the primary numeric types in python the int class is designed to represent integer values with arbitrary magnitude unlike java and ++which support different integral types with different precisions ( intshortlong)python automatically chooses the internal representation for an integer based upon the magnitude of its value typical literals for integers include and - in some contextsit is convenient to express an integral value using binaryoctalor hexadecimal that can be done by using prefix of the number and then character to describe the base example of such literals are respectively and the integer constructorint)returns value by default but this constructor can be used to construct an integer value based upon an existing value of another type for exampleif represents floating-point valuethe syntax int(fproduces the truncated value of for exampleboth int( and int( produce the value while int(- produces the value - the constructor can also be used to parse string that is presumed to represent an integral value (such as one entered by userif represents stringthen int(sproduces the integral value that string represents for examplethe expression int produces the integer value if an invalid string is given as parameteras in inthello ) valueerror is raised (see section for discussion of python' exceptionsby defaultthe string must use base if conversion from different base is desiredthat base can be indicated as secondoptionalparameter for examplethe expression int evaluates to the integer the float class the float class is the sole floating-point type in pythonusing fixed-precision representation its precision is more akin to double in java or ++rather than those languagesfloat type we have already discussed typical literal form we note that the floating-point equivalent of an integral number can be expressed directly as technicallythe trailing zero is optionalso some programmers might use the expression to designate this floating-point literal one other form of literal for floating-point values uses scientific notation for examplethe literal represents the mathematical value the constructor form of floatreturns when given parameterthe constructor attempts to return the equivalent floating-point value for examplethe call float( returns the floating-point value if the parameter to the constructor is stringas with float )it attempts to parse that string as floating-point valueraising valueerror as an exception