i dont know what happend
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#import time
|
||||
print("Prime number calc")
|
||||
checked = []
|
||||
primes=[]
|
||||
now=1
|
||||
|
||||
def is_ganz(zahl):
|
||||
try:
|
||||
return float(int(zahl)) == zahl
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
def is_teilbar(nummer, teiler):
|
||||
geteilt=nummer/teiler
|
||||
return is_ganz(geteilt)
|
||||
|
||||
|
||||
|
||||
while True:
|
||||
now += 1
|
||||
#if is_teilbar(now, 50):
|
||||
# print("[debug]: das ist cheecked:"+str(checked))
|
||||
if not now in checked:
|
||||
x=0
|
||||
for i in checked:
|
||||
if is_teilbar(now, i):
|
||||
x += 1
|
||||
if x==0:
|
||||
primes.append(now)
|
||||
print(now)
|
||||
checked.append(now)
|
||||
#time.sleep(0.01)
|
||||
@@ -0,0 +1,37 @@
|
||||
import sys
|
||||
import random
|
||||
import time
|
||||
|
||||
|
||||
if sys.stdin.isatty():
|
||||
word = list(input("Gib das zu erratende Wort ein:\n>"))
|
||||
else:
|
||||
word = list(sys.stdin.read().strip())
|
||||
printable_ascii = [
|
||||
' ', '!', '"', '#', '$', '%', '&', "'", '(', ')',
|
||||
'*', '+', ',', '-', '.', '/', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
|
||||
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
|
||||
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[',
|
||||
'\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e',
|
||||
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
|
||||
'z', '{', '|', '}', '~'
|
||||
]
|
||||
|
||||
guess = []
|
||||
|
||||
for i in word:
|
||||
guess.append(random.choice(printable_ascii))
|
||||
print("".join(guess), end="")
|
||||
|
||||
while True:
|
||||
if guess != word:
|
||||
for l in range(len(guess)):
|
||||
if guess[l]!=word[l]:
|
||||
guess[l]=random.choice(printable_ascii)
|
||||
print("\r"+"".join(guess), end="", flush=True )
|
||||
time.sleep(0.05)
|
||||
else:
|
||||
break
|
||||
Reference in New Issue
Block a user