Each press of the letter "p" should move backward through the list display the previous element. If the zeroth element is current being displayed, wrap around and display the last element.
import random
myList = ['A', 'B', 'C', 'D', 'E', 'F']
inList = print(random.choice(my_List))
while True:
userQuest = input("Press 'p' for previous or 'n' for next ")
if userQuest.lower == 'p':
pre_num = my_list[my_list.index(inList) -1]
else:
print(done)
Aucun commentaire:
Enregistrer un commentaire