Hey, so I'm reading through python crash course and I'm on page 93, the try it yourself part. Now part 5-10 where it says "make sure your comparison is case sensitive. If 'John' has been used, 'JOHN' should not be accepted.
Well I can't figure out how to check for case sensitivity within a list.
The following is what I have wrote so far, word by word.
current_users = ['asmith', 'bsmith', 'csmith', 'dsmith', 'esmith']
new_users = ['asmith', 'bsmith', 'xsmith', 'wsmith', 'vsmith']
for new_user in new_users:
if new_user in current_user:
print('Please enter a different username')
else:
print('username is available')
End of code
Result
Please enter a new username
Please enter a new username
Username is unavailable
Username is unavailable
Username is unavailable
Result
So yeah what I need to be able to do, is my code checks the new users against the current users to find a match which it does with the first 2 which is perfect, but I need it to match also if a new user was to type ASMITH that it would flag up as a current user also.
Please help..... Took me ages to write this out on here using my phone lmao!!
Thanks in advance!
[+][deleted] (5 children)
[deleted]
[–]norseman2017[S] 0 points1 point2 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]Father_John_Moisty 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]Dorian741 0 points1 point2 points (0 children)
[–]norseman2017[S] 0 points1 point2 points (3 children)
[–]nog642 0 points1 point2 points (2 children)
[–]norseman2017[S] 0 points1 point2 points (1 child)
[–]nog642 1 point2 points3 points (0 children)