Answers for "python how to run two while loops at the same time"

1

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()
Posted by: Guest on January-28-2021
1

run 2 loops simultaneously python

// LOOPING SIMULTANIOUSLY
for (i,j) in zip(range(12,20),range(22,30)): 
	print(i,j)
Posted by: Guest on June-18-2021

Code answers related to "python how to run two while loops at the same time"

Python Answers by Framework

Browse Popular Code Answers by Language