for i in range(0,len(displayList)):
#Test if the fist item in the current sub-list contains the text "Price Level
#Tip: Remeber that each sub-list is a (displayList). So you have
#to access its items via displayList followed by TWO indexes.
if i == "Price Level":
#Extract the second item from the current sub-list into variable called priceLevel
priceLevel = i
#Test if priceLevel is between previousPrice and currentPrice OR
# pL == pP OR
# pL == cP
if priceLevel >= previousPrice and priceLevel <= currentPrice or priceLevel == previousPrice or priceLevel == currentPrice:
if self.__currentPrice <= self.__previousPrice:
frequency = 400
duration = 700
#Sound the alarm. Pass in the frequency, duration.
else:
frequency = 800
duration = 700
winsound.Beep(frequency, duration)
#Print the text 'Alarm'
#can go back and check when the alarm was sounded.
print(Back.GREEN + "Alarm" + Style.RESET_ALL)
if __name__ == '__main__':
displayList = ['Price level']
play = Play()
# function call
play.ls(0, 100)
Comments
Leave a comment