Skip to content

appdev-projects/each-chapter

Repository files navigation

Ruby Practice

Run your Ruby file by typing ruby and then the name of the file you want to run in the Terminal.

If we want to run each_even_word.rb, we can write the command:

ruby each_even_word.rb

To re-run this command, you can use the UP and DOWN arrow keys to look at the history of commands you've run in a Terminal.

Each

each_spell_word.rb

Write a program that:

Asks your user to enter any word and have it spelled out letter by letter.

Input Georgia

Output

"G"
"E"
"O"
"R"
"G"
"I"
"A"

Example

"Enter a word for me to spell:"
Georgia
"G"
"E"
"O"
"R"
"G"
"I"
"A"

each_even_word.rb

Write a program that: Asks the user to enter a list of words separated by spaces. The program should only print the words that are have an even number of characters

Example (mountain pink vines is the input)

"Enter a list of words separated by spaces:"
mountain pink vines
"mountain"
"pink"

each_letter_count.rb

Write a program that:

Asks the user to enter a word. The program should print each letter in the word the number of times it appears in the word.

Example input: loop

Output:

"Enter a word"
loop
l appears 1 times
o appears 2 times
o appears 2 times
p appears 1 times

Specs

Click here to see names of each test

each_spell_word.rb spells 'Georgia' correctly

each_spell_word.rb spells 'Supercalifragilisticexpialidocious' correctly

each_letter_count.rb prints the letters and number of times the letters appear for the word 'levee'

each_letter_count.rb prints the letters and number of times the letters appear for the word 'loop'

each_even_word.rb prints the 'mountain' and 'pink' when the input is 'mountain pink vines'

each_even_word.rb prints nothing when the input is 'odd numbers squad'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •