Python 代码仅显示从临时数组到二维数组的最后一次最新输入? 代码仅显示从临时数组到二维数组的最后一次最新输入?请帮助我,因为我是计算机新手,并为gcse(SOVLED)进行计算
每次循环重复时,您都将aT重新定义为空列表。将Python 代码仅显示从临时数组到二维数组的最后一次最新输入? 代码仅显示从临时数组到二维数组的最后一次最新输入?请帮助我,因为我是计算机新手,并为gcse(SOVLED)进行计算,python,arrays,list,Python,Arrays,List,每次循环重复时,您都将aT重新定义为空列表。将aT=[]从循环中取出,它应该可以工作 IK i将thx im更改为新站点aTestScores来自何处?我在您的代码中缺少了它。如果他们没有输入是或否,会发生什么,您没有理由这样做。在我的代码顶部,在while循环之外,continue语句清除了它。注释不用于扩展讨论;这段对话已经结束。 #Prints title print ("WELCOME TO STUDENT TEST DATABASE") #array that stores names
aT=[]
从循环中取出,它应该可以工作 IK i将thx im更改为新站点aTestScores
来自何处?我在您的代码中缺少了它。如果他们没有输入是或否,会发生什么,您没有理由这样做。在我的代码顶部,在while循环之外,continue语句清除了它。注释不用于扩展讨论;这段对话已经结束。
#Prints title
print ("WELCOME TO STUDENT TEST DATABASE")
#array that stores names/scores
aTestScores =[]
(
"""
PRESS 1 TO ADD STUDENT AND HIS/HER GRADE
PRESS 2 TO VIEW STUDENT
PRESS 3 TO EXIT
"""
)
SChoise=input("please choose 1 2 or 3"
#if sChoice == "1":
aT =[]
while True:
aT.append (input("Input a name "))
aT.append (int(input("Input a Test Score ")))
print(aT)
print(aTestScores)
sPlayAgain=input("Do you want to input another name/number ")
if sPlayAgain.upper() == "YES":
continue
if sPlayAgain.upper() == "NO":
break
print (aT)
aTestScores.append(aT)
print(aTestScores)