lundi 1 mai 2017

calling input function multiple times within function

Looking for help in my function for "if number >2..." I'm having trouble figuring out how to call choice.append(input(...)) number - 2 times. any help would be appreciated!

def first_decisions2():   
number = int((input("Please enter the number of deciding options (eg. 2 or greater): ")))
choice = []
if number <2:
    return "I'm sorry - you didn't enter enough criteria. Please try again."
if number == 2:
    choice.append(input("Please enter the first choice: ")),
    choice.append(input("Please enter the second choice: "))
    return choice

if number >2:
    return (number - 2) * choice.append(input("Please enter the next choice: "))

return choice

Aucun commentaire:

Enregistrer un commentaire