n = input('Enter the student's name and grade)\nExample) David 537548 :')
while n=='\n':
n1,n2,n3,n4 = n.split()
n2 = int(n2)
n3 = int(n3)
n4 = int(n4)
L.append(n1)
M.append([n2,n3,n4])
Avg.append(int((n2+n3+n4)/3))
if (n2+n3+n4)/3 >= 90:
grade.append('A')
elif (n2+n3+n4)/3 >= 80:
grade.append('B')
elif (n2+n3+n4)/3 >= 70:
grade.append('C')
else :
grade.append('D')
I tried to make a code, but it didn't workㅜ<
while-loop python enter newline
First of all, input
should be in the repeat statement. Logicool
In addition, the input
function is considered to have ended when the opening character (\n) is entered.
Enter only the opening character to save an empty string.
The while
statement ending with the enter input can be implemented as follows.
while True:
n = input ('input:')
if n == '':
break;
© 2024 OneMinuteCode. All rights reserved.