为什么我的python程序没有正确引用它的特定数组?

时间:2015-12-02 08:12:45

标签: python

所以我做了一个字母游戏,用户选择元音或辅音,并选择元音或辅音列表中的随机字母。不幸的是,该程序没有正确引用其数组并生成随机字母。我该如何解决这个问题?

    intro = raw_input("Welcome to the Letters Game. Press Enter to begin.")
    biglist = ['B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z']
    smalllist = ['A', 'E', 'I', 'O', 'U']
    print "Ok! Let's get started!"
    print ""
    print "Ok, so you get a selection of 9 letters - either vowels or consonants."
    print ""
    first = raw_input("Vowel or consonant? (V or C) ")
    if first == "V" or "v":
        n1 = random.choice(biglist)
        print ""
        print "First letter:", n1
    else:
        n1 = random.choice(biglist)
        print ""
        print "First letter:", n1
    print ""
    second = raw_input("Vowel or consonant? (V or C) ")
    if second == "V" or "v":
        n2 = random.choice(smalllist)
        print ""
        print "Second letter:", n2
    else:
        n2 = random.choice(biglist)
        print ""
        print "Second letter:", n2
    print ""
    third = raw_input("Vowel or consonant? (V or C) ")
    if third == "V" or "v":
        n3 = random.choice(smalllist)
        print ""
        print "Third letter:", n3
    elif third == "C" or "c":
        n3 = random.choice(biglist)
        print ""
        print "Third letter:", n3
    else:
        print "Why you do this"
    print ""
    fourth = raw_input("Vowel or consonant? (V or C) ")
    if fourth == "V" or "v":
        n4 = random.choice(smalllist)
        print ""
        print "Fourth letter:", n4
    elif fourth == "C" or "c":
        n4 = random.choice(biglist)
        print ""
        print "Fourth letter:", n4
    else:
        print "Why you do this"
    print ""
    fifth = raw_input("Vowel or consonant? (V or C) ")
    if fifth == "V" or "v":
        n5 = random.choice(smalllist)
        print ""
        print "Fifth letter:", n5
    elif fifth == "C" or "c":
        n5 = random.choice(biglist)
        print ""
        print "Fifth letter:", n5
    else:
        print "Why you do this"
    print ""
    sixth = raw_input("Vowel or consonant? (V or C) ")
    if sixth == "V" or "v":
        n6 = random.choice(smalllist)
        print ""
        print "Sixth letter:", n6
    elif sixth == "C" or "c":
        n6 = random.choice(biglist)
        print ""
        print "Sixth letter:", n6
    else:
        print "Why you do this"
    print ""
    seventh = raw_input("Vowel or consonant? (V or C) ")
    if seventh == "V" or "v":
        n7 = random.choice(smalllist)
        print ""
        print "Seventh letter:", n7
    elif seventh == "C" or "c":
        n7 = random.choice(biglist)
        print ""
        print "Seventh letter:", n7
    else:
        print "Why you do this"
    print ""
    eighth = raw_input("Vowel or consonant? (V or C) ")
    if eighth == "V" or "v":
        n8 = random.choice(smalllist)
        print ""
        print "Eighth letter:", n8
    elif eighth == "C" or "c":
        n8 = random.choice(biglist)
        print ""
        print "Eighth letter:", n8
    else:
        print "Why you do this"
    print ""
    ninth = raw_input("Vowel or consonant? (V or C) ")
    if ninth == "V" or "v":
        n9 = random.choice(smalllist)
        print ""
        print "Ninth letter:", n9
    elif ninth == "C" or "c":
        n9 = random.choice(biglist)
        print ""
        print "Ninth letter:", n9
    else:
        print "Why you do this"

0 个答案:

没有答案