Nonewline python
Question: I am trying to print random numbers using random , but when I try to print the
output in one line using `end= " "` the output doesnt show anything until I
break the program.

    
    
    import random
    import time
    while True:
        x = random.randint(1,6)
        print(x, end=" ")
        time.sleep(1)
    

The out put is like this after I interrupt :

    
    
    C1 2 3 5 5 4 5 4 1 ---------------------------------------------------------------------------
    KeyboardInterrupt                         Traceback (most recent call last)
    


Answer: You can disable buffering by passing `flush=True` to `print` function (in
python3)

    
    
    print(x, end=" ", flush=True)
    

