Python Forum
how do I show 12 numbers from a huge number?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do I show 12 numbers from a huge number?
#31
The expression "2^2^34", or "2**2**34" in Python, could be written as 2(2 * 2 * 2 * 2...). The program can't do this because it doesn't have enough space. I haven't tried this yet, but you could try doing it the way a person would do it on paper. It would be a bit complicated to explain, so I'll do an example.
2426
x_53
['7', '2', '7', '8']
['1', '2', '1', '3', '0', '0']
Then the code should line them up and add like this
list1 = ['7', '2', '7', '8']
list2 = ['1', '2', '1', '3', '0', '0']
stringAnswer = ''
for x in range(0, len(list2)) + 1):
    if x < len(list2) - len(list1):
        stringAnswer += list2[x]
    else:
        stringAnswer += str(int(list2[x + (len(list2) - len(list1))]) + int(list1[x]))
I didn't test it so idk if my example code here will work properly, but I hope you get the idea of what I'm trying to do.
EDIT: The code on line 8, could possibly output a 2 digit number, and I didn't work that out, also, the code above would be adding backwards as well as adding the number to stringAnswer backwards. There are a few problems with the code, but again, it's just to give the idea of what can be done.
Reply


Messages In This Thread
RE: how do I show 12 numbers from a huge number? - by SheeppOSU - Sep-11-2019, 01:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Random Generator: From Word to Numbers, from Numbers to n possibles Words Yamiyozx 2 1,525 Jan-02-2023, 05:08 PM
Last Post: deanhystad
  Convert list of numbers to string of numbers kam_uk 5 3,134 Nov-21-2020, 03:10 PM
Last Post: deanhystad
  Divide a number - Multiple levels - Sum of all numbers equal to input number pythoneer 17 9,051 Apr-20-2018, 04:07 AM
Last Post: pythoneer
  Trying to get the week number from a string of numbers fad3r 2 3,301 Apr-15-2018, 06:52 PM
Last Post: ljmetzger
  Regular Expressions in Files (find all phone numbers and credit card numbers) Amirsalar 2 4,188 Dec-05-2017, 09:48 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020