Python Forum

Full Version: Printing googolplex
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi. I am trying to write a program that will print the number googol plex (1 followed by a googol(1 followed by 100 zeros)zeros). However, when I run the code the interface is blank. Here is my code:
number_googol="1"
number_googolplex="1"
r_t=0
r_t1=0
zero="0"

while (r_t<100):
    number_googol=number_googol + zero
    r_t=r_t+1
    

while (r_t1<int(number_googol)):
    number_googolplex=number_googolplex + zero
    r_t1=r_t1 +1

if (r_t1 == int(number_googol)):
    print(number_googolplex)
    
     
I encountered no errors trying to run the code.
Can anyone help?
it's because your second loop is running googol times and it takes a long time :) I don't think it's possible to print such a large number - https://www.physicsforums.com/threads/ho...ex.690823/
The following program prints googolplex
# python 3 script to print the number googolplex
import sys
w = sys.stdout.write
f = sys.stdout.flush
s = '0' * 100

w('1')
for i in range(10**98):
    w(s)
    f()