Never Ending Loop but when will end doesn't know program in python

About the Program

In this program we are going to code the simple python program with loop. But a catch is when the loop will terminate no one knows maybe never maybe in 5 minutes or maybe in 5 sec 

Program

import random 
a = 137 
print(a) 
b = 0 
while True: 
    b+=1 
    r=random.randint(1,10000000000) 
    print(str(b)+" "+str(r)) 
    if r==a: 
        print(r," is succesfully founded") 
        break 


What is happening with the code 

The code is going into the loop and in loop it is taking a random number and checking with our initialized number if found it gets exit

comment down the number when your loops gets exit.

tip :- to execute program fast just change the   r=random.randint(1,10000000000) to     r=random.randint(1,1000) 



Comments

Popular posts from this blog

Rectangle with pencil in paint with the help of Python programming

How to get all links of any website using Python