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