Skip to content

Instantly share code, notes, and snippets.

@DaraDDB1
DaraDDB1 / phscale.py
Created September 22, 2016 14:34
STJLOL-DC-phscale
while True:
print("Hello, and welcome to the Acid/Base Detector! Type your number below and I will tell you whether it is an acid or a base!")
ph = input("Please type your number between 0 and 14 here ----> ")
if ph <= "7":
choice=input("Does it have a sour taste? Type Y or N -----> ")
if choice == "Y":
print("Looks like you have an acid on your hands! Be very careful!")
elif choice == "N":
@DaraDDB1
DaraDDB1 / forloops.py
Last active October 4, 2016 09:42
STJLOL-DC-forloops.py
#this code is the for loop
#easy task
bag = ["iPad", "pencil case", "books", "lunch"] #this is whats in the bag
for item in bag:
if item == "iPad":
print("Hey, look! I have your iPad!") #when ipad comes through, it will print this
else:
print("This isn't an iPad!") #if it isnt ipad, it will print this
@DaraDDB1
DaraDDB1 / STJLOL-DC-opencode.py
Last active October 25, 2016 09:03
opencode.py
from time import sleep
while True:
print("This is the PH Scaler!") #this is a print statement
choice = input("Are you ready? Type y for yes")
if choice == "y":
@DaraDDB1
DaraDDB1 / STJLOL-DC-homework.py
Last active March 2, 2017 15:25
STJLOL-DC-homework.py
import RPi.GPIO as GPIO #imports gpio
from time import sleep #imports sleep
import readchar #imports characters
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.setup(11, GPIO.IN) #sensor input
GPIO.setup(13, GPIO.OUT)
@DaraDDB1
DaraDDB1 / s.py
Created March 7, 2017 10:32 — forked from dobrienSTJ/s.py
IR Rangefinder Rover
#Only in PYTHON2.7
import RPi.GPIO as GPIO #GPIO Libraries
from time import sleep #Sleep Functions
import readchar #keyboards
GPIO.setwarnings(False)#Blocks error warnings
GPIO.setmode(GPIO.BCM) #Setting Up
GPIO.setup(23, GPIO.OUT) #back right
GPIO.setup(24, GPIO.OUT) #front right
#Welcome to Dara's program checklist
while True: #will loop everything thats indented below it
from time import sleep #makes sleep accessable
#1. Print statements
print("Hi, my name is Dara")
#this prints the users message. OUTPUT:
#Hi, my name is Dara
@DaraDDB1
DaraDDB1 / classobject.py
Last active January 25, 2018 10:42
Classes and Objects
class Monster: #this makes the monster a class
health = 15 #shows that the health is equal to 15
def gethit(self): #defines the function
self.health = self.health-1 #this shows that if you use gethit, itll reduce the health by 1
print("Ouch! My health is now " + str((self.health)) #it will print this statement
def sayhealth(self):
print("My health is " +str((self.health)) #this will print your health if you type it
from time import sleep #lets the sleep option be used
import webplayer #lets the youtbe things open
print("Welcome to MoodyBops, a song generator depending on your mood!") #welcome
print("We have multiple moods you can choose from.")
print("Here is the list") #tells you there is a list
music=input("Please choose the mood you are feeling from this list: happy, sad, chill, motivated, dancy.") #the list