Created
October 2, 2012 21:46
-
-
Save amiramke/3823512 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| My Challenge: | |
| Pseudocode: | |
| Script: REVERSE WORDS IN A SENTENCE | |
| GET a sentence from user input | |
| FOR each word in the sentence | |
| REVERSE SINGLE WORD | |
| ENDFOR | |
| PRINT the converted sentence | |
| Gvir's Challenge' solution: | |
| def remove_vowels_if_more_than_2_and_upper() | |
| puts "Enter word:" | |
| original_word = gets.chomp | |
| no_vowels_word = original_word.gsub(/[aAeEoOuUiI]+/,"") | |
| if original_word.length-no_vowels_word.length > 2 | |
| return no_vowels_word.upcase | |
| else | |
| return original_word | |
| end | |
| end | |
| puts remove_vowels_if_more_than_2_and_upper() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment