Is there any way to shorten this code down? Or a alternative? It's not neccessary but im honestly curious. Thanks in advance!
import time
print("P")
time.sleep(0.5)
print("L")
time.sleep(0.5)
print("E")
time.sleep(0.5)
print("A")
time.sleep(0.5)
print("S")
time.sleep(0.5)
print("E")
time.sleep(0.5)
print(" ")
time.sleep(0.5)
print("L")
time.sleep(0.5)
print("E")
time.sleep(0.5)
print("A")
time.sleep(0.5)
print("V")
time.sleep(0.5)
print("E")
time.sleep(0.5)
print(":)")
CodePudding user response:
for letter in "PLEASE LEAVE :)":
print(letter)
time.sleep(0.05)
CodePudding user response:
You can use a for
loop (note that we need to separate these out into individual elements, as the last entry has two characters):
import time
entries = ["P", "L", "E", "A", "S", "E", " ", "L", "E", "A", "V", "E", ":)"]
for entry in entries:
print(entry)
time.sleep(0.5)