TRY THIS INSTEAD | SCRIPT SAMPLES
SCRIPT SAMPLES
In this section we have a host of random script samples that provide you with various methods of completing tasks. Most methods are posted on the Try This Instead videos.
HIDE YOUR PASSWORD ENTRY
Hide your password on text-based systems. Note this does not encrypt your password, it just adds security because anyone looking over your shoulder cannot see it when you type.
PASSWORD ENCRYPTION
Using bcrypt to add an encryption layer to passwords.
MAKE LARGE NUMBERS EASIER TO READ
Making large numbers easy to read using the underscore method for the developer and f string formatting for the user.
USE A DICTIONARY INSTEAD OF A LONG IF STATEMENT
Remember these is nothing wrong with lang IF statements. Code should be easy to read at a glance and IF statements are great at this.
USING THE ZIP METHOD
If you have two related lists, then the zip method might be a better way for you to handle them. With the zip method it does not matter if multiple lists are the same length
USING F STRING TO ADD LEADING OR / AND FOLLOWING CHARACTERS
Using this method you can shorten your code by passing in parameters of how you want lines formatted.