samedi 17 juillet 2021

I'm make a program of a random string from a List and I ran to a problem. It ask the user to press p for previous string from the list

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