0

So, I am trying to make a menu program in python and when i write the choice it gives me the menu again instead of continuing! the contents of the menu don't matter! I have only written the 1st choice of the menu!

synexeia = True
tameio=0
titloi= ["Ο άρχοντας των δαχτυλιδιών","Έγκλημα και τιμωρία","Η φάρμα των ζώων","Hobbit"]
author= ["J.R.R. Tolkien","Φ. Ντοστογιέφσκι","G. Orwell","J.R.R. Tolkien"]
copies= [5,2,4,1]
price= [11.4,13.7,9.7,8.5]
while (synexeia==True):
    print ("Μενού επιλογών")
    print ("1. Εμφάνιση διαθέσιμων βιβλίων.")
    print ("2. Αναζήτηση βιβλίου.")
    print ("3. Πώληση βιβλίου.")
    print ("4. Προμήθεια βιβλίου.")
    print ("5. Αλλαγή τιμής διαθέσιμου βιβλίου.")
    print ("6. Προβολή ποσού ταμείου.")
    choice =input("Διάλεξε μία από τις παραπάνω επιλογές : ")
    if (choice==1):
        for i in range(0, (len(copies)-1)):
            if (copies>=1):
                print (titloi[i])
                print (author[i])
                print (copies[i])
                print (price[i])
  • Not 100% sure, but it sounds like you're expecting choice to be "1" and then jumping into the if statement, if that is the case can clarify what is being returned by `input` and verify `choice` is what you'd expect – James Kirsch Jan 02 '16 at 12:31
  • The answer was given by Daniel Sanchez already, I just want to add that using a dictionary with title as key and a list of all the meta info as value would probably be a better approach than just using mutliple lists. – Philip Feldmann Jan 02 '16 at 12:34
  • Note that your code also has other issues, like `if (copies>=1):` comparing a `list` to an `int`. – TigerhawkT3 Jan 02 '16 at 12:47

1 Answers1

1

Easy task:

input returns a string so choice will never be == 1, just change that line to:

choice = int(input("Διάλεξε μία από τις παραπάνω επιλογές : "))
Netwave
  • 40,134
  • 6
  • 50
  • 93