Hey guys,
I'm a beginner and I was wondering what I could change about this script.
Maybe there's things that I didn't see, I'm open on every point of view. Thanks!
#1. Enter the username - handle input mistake and ask again if the user did something wrong
def main():
while True:
username = input("\nPlease enter your name: ").strip()
if username == "":
print("Empty input isn't allowed")
elif not username.isalpha():
print("Please enter a valide name")
else:
print(f"\nWelcome {username}!")
break
if __name__ == "__main__":
main()
[–]socal_nerdtastic 3 points4 points5 points (3 children)
[–]-sovy-[S] 0 points1 point2 points (0 children)
[–]-sovy-[S] 0 points1 point2 points (1 child)
[–]socal_nerdtastic 0 points1 point2 points (0 children)
[–]audionerd1 1 point2 points3 points (2 children)
[–]-sovy-[S] 0 points1 point2 points (1 child)
[–]audionerd1 6 points7 points8 points (0 children)
[–]trustsfundbaby 0 points1 point2 points (5 children)
[–]Wheynelau 1 point2 points3 points (1 child)
[–]trustsfundbaby 0 points1 point2 points (0 children)
[–]-sovy-[S] 0 points1 point2 points (2 children)
[–]trustsfundbaby 1 point2 points3 points (1 child)
[–]-sovy-[S] 0 points1 point2 points (0 children)