-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathThrash Coding.py
More file actions
50 lines (43 loc) · 1.52 KB
/
Thrash Coding.py
File metadata and controls
50 lines (43 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Thrash Coding with Python for Advanced Python Programmers.
# These Python examples might be a bit tricky for beginners to fully
# understand. However, this is what Python is sometimes all about.
# These Python program examples below create fun auto typing
# text, using the 'len()' function within a while-loop to count the entire
# length of text, letter by letter, including empty spaces in between
# text words/sentences alike.
import os,time;from time import sleep as delay
clear_screen='cls'
line_break='\n'
indent=' '*2
auto_type_speed=.05
text,text_len=print,len
auto_text=(
'Auto Backward Typing Text is so much fun to make.'[::-1],
'.ekam ot nuf hcum os si txeT gnipyT drawkcaB otuA'[::-1])
length=0
while length<=text_len(auto_text[0]):
os.system(clear_screen)
text(line_break+indent+auto_text[0][:length]) # forward forward text
delay(auto_type_speed)
length+=1
delay(1)
length=0
while length<=text_len(auto_text[0]):
os.system(clear_screen)
text(line_break+indent+auto_text[0][length:]) # reverse forward text
delay(auto_type_speed)
length+=1
length=0
while length<=text_len(auto_text[1]):
os.system(clear_screen)
text(line_break+indent+auto_text[1][:length]) # forward backward text
delay(auto_type_speed)
length+=1
delay(1)
length=0
while length<=text_len(auto_text[1]):
os.system(clear_screen)
text(line_break+indent+auto_text[1][length:]) # reverse backward text
delay(auto_type_speed)
length+=1
delay(1)