は、ここに私の答えは:
def numberTest():
global x, y, z
L1 = []
x = 0
y = 6
z = 1
while(x < 6):
try:
user = int(input("Enter {0} more number(s)".format(y)))
print("Your entered the number {0}".format(user))
x += 1
y -= 1
L1.append(user)
except ValueError:
print("That isn't a number please try again.")
while(z > 0):
numb = input("Type \"total\" for the total and \"average\"").lower()
if(numb == "total"):
a = sum(L1)
print("Your total is {0}".format(a))
z = 0
elif(numb == "average"):
b = sum(L1)/ len(L1)
print("Your average is {0}".format(round(b)))
z = 0
else:
print("Please try typing either \"total\" or \"average\".")
numberTest()
が、私はこの数回試したと私はそれが動作します知っています。コードの一部について混乱している場合は、コメントを追加してさらに質問に回答します。
'sum(list)'ですが、組み込み型なのでリストに 'list'という名前を付けないでください。 – smarx
あなたは[mcve]を持っているわけではありませんが、私は 'numb1 = numb.lower'はあなたが思っていることをしません。 – jonrsharpe