Taking easy stuff and pushing it to the limits.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Error handling in Python is done through the use of exceptions that are caught in try blocks and handled in except blocks. If an error is encountered, a TRy block code execution is stopped and transferred down to the except block, as shown in the following syntax: | |
data = 'Hello and welcome to Earth (if you are an alien)' | |
try: | |
f = open("test.txt") | |
except IOError: | |
print("Cannot open file.") | |
## In addition to using an except block after the try block, you can also use the finally block. The code in the finally block will be executed regardless of whether an exception occurs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from microbit import * | |
import radio | |
radio.config(channel = 5) | |
radio.on() | |
while True: | |
display.show("f") | |
if button_a.is_pressed(): | |
radio.send("left") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
from PIL import Image | |
import zbarlight | |
import pygame, sys | |
from pygame.locals import * | |
global DISPLAYSURF, FPSCLOCK | |
pygame.init() | |
DISPLAYSURF = pygame.display.set_mode((400, 300)) | |
pygame.display.set_caption("QR code reader") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This file is the package required in the Piece Check | |
Text Editing Application. You can check out the Repo | |
here, link below - | |
https://github.com/rudrathegreat/Piece-Check--Text-Editing-App | |
If you would like to experiment with the Piece Check code, | |
then just simply go here, link below, to the gist which | |
contains the code - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Welcome to Piece Check, a text editing application for | |
the people who do not really know or remember the grammar | |
rules in English. | |
This application requires GingerIt and Python 3.6. You can | |
simply download GingerIt from the command line using the | |
following line - | |
pip install gingerit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Only works on BBC Microbits. | |
The code was originally from | |
the repository Microbit Projects, | |
link below - | |
https://github.com/rudrathegreat/Microbit-Projects | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Only works on Machines with Bash scipts, not Batch Scripts | |
pwd | |
echo '' | |
for i in $(ls) | |
do | |
echo $i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This program is designed to be used on the Raspberry | |
Pi only or any other device which accepts Python and | |
can do serial communication. | |
You will not find the module serial in your Python | |
which has been downloaded. You need to download it | |
seperately. | |
This code originally came from the repository Zumo |