Created
January 17, 2019 03:22
-
-
Save ChantalDemissie/7b797cfc0f99f03e86a7ec803e42cb90 to your computer and use it in GitHub Desktop.
day4activities.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Hello please create a password to access your account" | |
puts "This must include a letter, number and special characters and be 8 or more characters" | |
password_is_min_length = false | |
password_contain_special_character = false | |
password_contain_number = false | |
special_characters = %w[@ % * !] | |
until password_is_min_length \ | |
&& password_contain_special_character \ | |
&& password_contain_number | |
password = gets.chomp | |
password_is_min_length = password.length >= 8 | |
special_characters.each do |special_character| | |
if password.include? special_character | |
password_contain_special_character = true | |
break | |
end | |
end | |
(0..9).each do |number| | |
if password.include? number.to_s | |
password_contain_number = true | |
break | |
end | |
end | |
end | |
puts "Valid Password congratulations!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Chantal,
Thank you for submitting the password verification exercise! Good work, below is some feedback/suggestions for you:
.rb
file extension for each of your files, not just the name of the gistputs
prompts to more clearly indicate to the user what they are or are not doing correctly.Hope this helps, please reach out to me if you have any questions. See you in class on Tuesday!
-Brooks