python two while loops at same time

import threading
import time

def infiniteloop1():
    while True:
        print('Loop 1')
        time.sleep(1)

def infiniteloop2():
    while True:
        print('Loop 2')
        time.sleep(1)

thread1 = threading.Thread(target=infiniteloop1)
thread1.start()

thread2 = threading.Thread(target=infiniteloop2)
thread2.start()

Here is what the above code is Doing:
1. We define two functions, infiniteloop1 and infiniteloop2.
2. We create two threads, thread1 and thread2.
3. We start the threads.

The output of the above code is:
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2
Loop 1
Loop 2