COMPUTER SCIENCE CAFÉ
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
Picture
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.

    
Picture
SUGGESTIONS
We would love to hear from you
SUBSCRIBE 
To enjoy more benefits
We hope you find this site useful. If you notice any errors or would like to contribute material then please contact us.