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
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": |
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 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 |
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 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": |
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 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) |
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 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 |
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 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 |
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
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 |
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 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 |