87 lines
1.5 KiB
Python
87 lines
1.5 KiB
Python
#!/usr/bin/python
|
|
|
|
|
|
i = 0
|
|
|
|
while i < 100:
|
|
print("HIII: " + str(i))
|
|
i = i + 1
|
|
|
|
a = input("gib ne zahl ei: ")
|
|
|
|
print(a + "lol")
|
|
|
|
|
|
def test(lol):
|
|
print(lol)
|
|
|
|
test(11)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import threading
|
|
import time
|
|
|
|
exitFlag = 0
|
|
|
|
class myThread (threading.Thread):
|
|
def __init__(self, threadID, name, counter):
|
|
threading.Thread.__init__(self)
|
|
self.threadID = threadID
|
|
self.name = name
|
|
self.counter = counter
|
|
def run(self):
|
|
print ("Starting " + self.name)
|
|
print_time(self.name, 5, self.counter)
|
|
print ("Exiting " + self.name)
|
|
|
|
def print_time(threadName, counter, delay):
|
|
while counter:
|
|
if exitFlag:
|
|
threadName.exit()
|
|
time.sleep(delay)
|
|
print ("%s: %s" % (threadName, time.ctime(time.time())))
|
|
counter -= 1
|
|
|
|
# Create new threads
|
|
thread1 = myThread(1, "Thread-1", 1)
|
|
thread2 = myThread(2, "Thread-2", 1)
|
|
|
|
# Start new Threads
|
|
#thread1.start()
|
|
#thread2.start()
|
|
|
|
print ("Exiting Main Thread")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class myThread (threading.Thread):
|
|
def __init__(self, threadID, name, num):
|
|
threading.Thread.__init__(self)
|
|
self.threadID = threadID
|
|
self.num = num
|
|
def run(self):
|
|
calcN(self.name, self.num)
|
|
|
|
def calcN(threadName, num):
|
|
for y in range( num, num + 100):
|
|
for x in range(2, y+1):
|
|
if y % x == 0 and x != y:
|
|
break
|
|
if x == y:
|
|
print(x)
|
|
|
|
|
|
for i in range(1, 100000, 100):
|
|
thread1 = myThread(i, "Thread-" + str(i), i)
|
|
thread1.start()
|
|
|
|
|