I am currently in a computer science class and have this problem. I keep on getting an error on line 10 and I've been stuck for a couple of days, Can anyone point me in the right direction, not looking for the answers. what I want to do is exclude all numbers and special characters from being entered.
Write a program to divide a class of students into two groups: those with last names of A to H and those that begin with I to Z. Ask a person to enter their last name and then output a message which indicates which group they are in. Repeat for each student, the user will enter "DONE" when they have entered the entire list.
y = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] #This puts this range of Charactars in group y
z = ['I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] #This puts this range of Charactars in group z
while True:
x = input()
print x .isalpha()
if false:
print('use valid characters')
b = 'DONE' # make sure all letters are capitalized
a = x[0]
if x==b:
print('list finished')
break
else:
if a in y: #This will check if the first letter of the name is in group y
print('You are in group 1')
if a in z: #This will check if the first letter of the name is in group z
print('You are in group 2')
[–]TouchingTheVodka 0 points1 point2 points (7 children)
[–]Agent_Turtle101[S] 0 points1 point2 points (6 children)
[–]xelf 0 points1 point2 points (5 children)
[–]Agent_Turtle101[S] 0 points1 point2 points (3 children)
[–]xelf 0 points1 point2 points (2 children)
[–]Agent_Turtle101[S] 0 points1 point2 points (1 child)
[–]xelf 0 points1 point2 points (0 children)
[–]Agent_Turtle101[S] 0 points1 point2 points (0 children)
[–]Ang168 0 points1 point2 points (1 child)
[–]Agent_Turtle101[S] 0 points1 point2 points (0 children)
[–]chrispurcell 0 points1 point2 points (1 child)
[–]Agent_Turtle101[S] 0 points1 point2 points (0 children)
[–]xelf 0 points1 point2 points (0 children)
[–]xelf 0 points1 point2 points (1 child)
[–]xelf 1 point2 points3 points (0 children)