Coding trickery - a trio of tantalizing techniques to dumbfound your friends

By Asher Yip

Hello everyone! Do you want to impress your friends with three awesome coding tricks? If you want to code, you have come to the right place. I will teach you three coding techniques that will surprise you and your family. 

To show you my coding tricks however, you must download VSCode, the code editor we will be using for these tricks.

Download here… https://code.visualstudio.com/

After you download VSCode, you want to:

  1. Press skip on all of the introductions

  2. Press the new file button

  3. Name your file as whatever you want but it must end with .py.

  1. Rotate your screen - prank your friends! (Windows only)

In your terminal(You can access it by typing in on the search bar on your laptop), type “pip3 install rotate-screen”.

This is what installing rotate-screen looks like.

To make your screen rotate, type below…

[codeblocks] import rotatescreen

screen = rotatescreen.get_primary_display()

screen.rotate_to(180) [codeblocks]

Fill in the code in the file. Now your file should look like this.

The import rotate screen line imports the rotate screen plugin, so you can rotate your screen.

The screen.rotate_to function determines the angle of how much the screen wants to rotate. In this case it rotates the screen by 180 degrees.

2. Making a replica of Google Chrome (or any other website)

Make a file called googlechrome.py and type the code in the following… but if you didn’t download certain packages, this won’t work. To install the packages, in the terminal, type “pip3 install PyQt5” and “pip3 install PyQtWebEngine”. Restart your computer and this will work.

[codeblocks]

codeblocks

The self.browser.setUrl function determines what website it launches the browser on. You can change the website in quotations near that function to launch with a different website.

3. Talking bot

We are going to make a simple bot in the terminal so whatever you type, the computer will say. We need to download a module named pyttsx3. We are going to type in the terminal “pip3 install pyttsx3”. Then copy the code below…

However, this will not work if your mac OS is a old version.

Go to the work area in here and type what you want the computer to say…

There is the area in Type what you want your computer to say. Hover the text and click it and type what you want.

That’s it for today's article, l hope you find coding easy and the tasks easy to do!