jeudi 1 septembre 2016

else if issue Python 3.5 for quiz program/app

def prompt_letter_count(word):
    correct = word_map[word]['letters']
    ans = input('How many letters does "{}" contain?'.format(word))
    if ans.isalpha():
        print('Please type in numbers')
        else
        return check(int(ans), correct)

Trying to add some validation to a quiz app application for year 1 english students. I'm trying to get the questions to not allow letters in questions that ask for a number or amount and vice versa for questions such as "what the nth letter to not allow digits to be entered"

Aucun commentaire:

Enregistrer un commentaire