re: Challenge: Write a program that never stops VIEW POST

FULL DISCUSSION
 

python

while 1:1

never-ending song

from itertools import cycle
import time
list = ['This is the song that never ends',
    'It just goes on and on my friends',
    'Some people started singing it, not knowing what it was',
    'And they\'ll continue singing it forever just because...']

for line in cycle(list):
    print(line)
    time.sleep(.25)

non-stop random numbers

from random import randint
def infinite_random():
    while True:
        yield randint(1,1000000000)

for x in infinite_random():
    print(x)

lots of random user information

import requests
def get_users():
    while True:
        yield requests.get('https://randomuser.me/api/').json()['results'][0]

for user in get_users():
    print('{0[name][first]} {0[name][last]} - born {0[dob]}'.format(user))
 
code of conduct - report abuse