Write small python program on turning something on and turning something off.
About 10 lines. As long as it has GPIO in it
Codesnap:

Coding:
import RPi.GPIO as GPIO #Here it is GPIO to import
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
CLK = 18 # Change here values to then pins you are using
MISO = 20
MOSI = 21
CS = 8
mcp = Adafruit_MCP3008.MCP3008(clk=CLK, cs=CS, miso=MISO,
mosi=MOSI)
GPIO.setmode(GPIO.BCM) #sets mode
GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP) #Button Pin
state = GPIO.input(22) #Get's input button
while True:
if state == 1:
break
else:
continue
Write small python program on turning something on and turning something off. About 10 lines. As ...
Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...
USING PYTHON 1. Write a small program that asks for an integer number from the user and print all the prime numbers (2,3,5,7,etc) less than the input number. 2. How long it takes for your program to print the prime numbers less than 100. (Use magic functions)
Python: True or False Questions
1)A Python interpreter is a translator that translates program lines written in other programming languages into Python, one segment at a time. 2)An interpreter executes machine instructions for program lines. s for program lines. 4)A compiler assembles different program lines into a single program, so it can be translated as a whole. 5)A compiler creates machine instructions for a whole program. 6)Translating an entire story from Chinese to English is analogous to compilation 7)An object...
Write a program in python that reads each line in a file, reverses its lines, and writes them to another file. For example, if the file input.txt contain the lines: Mary had a little lamb Its fleece was white as snow And everywhere that Mary went The lamb was sure to go. and you run your Python file then output.txt contains The lamb was sure to go. And everywhere that Mary went Its fleece was white as snow Mary had...
Please help with this python assignment. Thank you. question 1 Write a Python program to read a file line by line store it into a variable. question 2 Write a Python program to read a file line by line store it into an array. question 3 Write a python program to find the longest words. question 4 Write a Python program to count the number of lines in a text file. question 5 Write a Python program to count the...
Write a program using Python that loops through lines of a file, assuming each line of input will consist of just a single word (and a newline, of course). As it loops through each line, your program should print out any words that contain two vowels next to each other. The vowels do not have to be the same. You should create a test input file and make your script process it.
(1)Write a program in Python that reads an arbitrary-length file. All lines that start with semicolons (;) or pound signs (#) should be ignored. All empty lines must be ignored Lines containing a string between square brackets are sections. Within each section, lines may contain numbers or strings. For each section, calculate the lowest, highest and modal (most common) number, and print it. In each section, also count all non-whitespace characters, and print that. Example input: ; this is a...
Have the python program countdown from 10 to 1 and then have the message Blast Off! appear must use a for loop
With Python 3.8.1 Write a Python program that reads in 10 integer quiz grades and computes the average grade.
Write a python program to design a function with a parameter called A (which is between 1 and 10) and prints the multiplication table for 1 to A. • Note: Do not need to draw the horizontal and vertical lines. • Example for A = 10