0-homework3

import RPi.GPIO as GPIO import time gpio_out_lt = [3,5,7,8,10,11,12,13] gpio_in_lt = [15,16,18,19,21,22,23,24] # Use physical pin numbers GPIO.setmode(GPIO.BOARD) for i in range(8): GPIO.setup(gpio_out_lt[i], GPIO.OUT) for i in range(8): GPIO.output(gpio_out_lt[i], False) for i in range(8): GPIO.setup(gpio_in_lt[i], GPIO.IN) print ("02.DIPSWITCH DEMO Starting... ") while True: for i in range(8): if GPIO.input(gpio_in_lt[i]): GPIO.output(gpio_out_lt[i], True) else: GPIO.output(gpio_out_lt[i], False) time.sleep(0.1)

score = int(input("score:"))

if score >= 60:

print("成績及格!")

else:

print("不及格,被當了!")