Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program is using PYTHON IDLE 2.7.9 if that makes any difference. Boot up th

ID: 3665699 • Letter: T

Question

This program is using PYTHON IDLE 2.7.9 if that makes any difference.

Boot up the Raspberry Pi.

Open IDLE.

Enter the program below.



Name = ‘Put Your Name Here’

Class= ‘ECT109’

Assignment = ‘Week 5 Lab 2’


#------------------------------------------------------------------

# The WHILE Loop

#------------------------------------------------------------------


print Name

print Class

print Assignment


import time

from time import sleep

from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate


lcd = Adafruit_CharLCDPlate()


#------------------------------------------------------------------


x = 0

while (x < 10):

If lcd.buttonPressed(lcd.LEFT):

x = x + 1

print x

sleep(1)

else:

print ‘Done’




Your assignment is to write a Python program to loop until a variable x reaches 15. With each press of the RIGHT button, variable x is incremented by 2.

Explanation / Answer

Name = 'Put Your Name Here'
Class= 'ECT109'
Assignment = 'Week 5 Lab 2'
#------------------------------------------------------------------

# The WHILE Loop

#------------------------------------------------------------------
print Name
print Class
print Assignment
import time
from time import sleep
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
lcd = Adafruit_CharLCDPlate()
#------------------------------------------------------------------
x = 0

while (x <= 15):
if lcd.buttonPressed(lcd.RIGHT):
x = x + 2
print x
sleep(1)
else:
print 'Done'

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote