Apr-25-2019, 02:11 PM
One way of achieving desired result (with Python >=3.6):
- normalize input as Gribouillis suggested
- check whether username in list of users
- print capitalized username with Hello or Try Again
- normalize input as Gribouillis suggested
- check whether username in list of users
- print capitalized username with Hello or Try Again
>>> username = input('login: ').split()[0].lower() >>> users = ['jack', 'jill'] >>> if username in users: ... print(f'Hello {username.capitalize()}') ... else: ... print('Try again!')
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.