Reputation: 23
for letter in str:
sys.stdout.write(letter)
time.sleep(.1)
print(letter, end='')
import sys,time,random
typing_speed = 50 #wpm
def slow_type(t):
for l in t:
sys.stdout.write(l)
sys.stdout.flush()
time.sleep(random.random()*10.0/typing_speed)
print ''
import sys,time
def sprint(str):
for c in str + '\n':
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(3./90)
sprint('hello world')
def print_slow(str):
for letter in str:
sys.stdout.write(letter)
sys.stdout.flush()
time.sleep(0.1)
print_slow("Type whatever you want here")
And they all give the same result:
TypeError: sprint()/print()/slowprint()/print_slow() takes 1 positional argument but 2 were given
print('kort 1: ', kort_1)
print('Kort 2: ', kort_2)
print('Summa: ', summa )
I have spent close to 10 hours just searching, but i have found no awnser that works with my code. :(
Upvotes: 0
Views: 107
Reputation: 957
I think you were close multiple times. Looking at your error i think something in your calling of your own functions is not lining up with the way you intend to use it.
Because this works on my side:
import time
def printSlow(toPrint):
for letter in toPrint:
print(letter, end='')
time.sleep(0.1)
printSlow("Hello")
Which is very similar to the various versions you've tried.
Upvotes: 2