Home > other >  Python problem, how to string, the print of the big number
Python problem, how to string, the print of the big number

Time:09-22

The class BigNumber:

Def __init__ (self, string_big=None) :
"" "the constructor for the class BigNumber "" "
# the initialize a list

Self. List_big=[]
A=scan (list_big, len (list_big))
Self. String_big=string_big

# to complete


Def the __str__ (self) :
"" "the tostring method for class BigNumber "","
# for the I in list_big:
# return list_big [I]


Def compare (self, big2) :
"" "compare 2 big Numbers and return (self is big1)
& gt; If big1 & gt; Big2
==if big1 & lt; Big2 "" "
Return "not done"

CodePudding user response:

In the python strings into a large, need not bother?
Direct int () line:
 
If __name__=="__main__ ':
Snum='321453215434321432143212432532529053248590324093423231'
Print (int (snum))

CodePudding user response:

Don't know how long string need to turn, is good PI of millions of people?
  • Related