Skip to content

python mini project#23

Open
everodriguezval wants to merge 9 commits intoalexnaylor99:mainfrom
everodriguezval:main
Open

python mini project#23
everodriguezval wants to merge 9 commits intoalexnaylor99:mainfrom
everodriguezval:main

Conversation

@everodriguezval
Copy link

No description provided.

Comment on lines +16 to +19
if not user_names:
print('You have not entered any names. Please try again')
elif not re.search(r'^[a-zA-Z ]+$', user_names):
print('Names should only contain letters and be separated by spaces')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifying if the user has entered a name or not is important for input validation, so prompts for that. Using regex to check for specific character requirements in the entered list of names is a smart way to confirm that the input is clean.

Copy link

@mjoseph26 mjoseph26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The program works as intended with good input validation to check if the user enters valid names and to check that they request a valid number of random names to be generated. It may be good to comments to more complex lines of code such as when you use random. sample so that it is easier for someone with little programming knowledge to understand. You follow the conventions for function and variable naming and the code overall is laid out in a logical manner. One thing you could try to do is check that the user is only allowed to enter in unique names although it won't affect the functionality of your application, since unique names will be selected anyway. It seems more logical for a user to provide a unique set of names to select one name from it, rather than allowing them to pass in the same name multiple times. Overall, great job with this exercise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants