each-chapter

  • d1_737809
    了解作者
  • 11.4KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 03:57
    上传日期
Ruby实践 通过输入ruby并在终端中要运行的文件名来运行Ruby文件。 如果要运行each_even_word.rb ,可以编写以下命令: ruby each_even_word.rb 要重新运行此命令,可以使用UP和DOWN箭头键查看在终端中运行的命令的历史记录。 每个 each_spell_word.rb 编写一个程序,该程序: 要求您的用户输入任何单词,并逐字母拼写出来。 输入Georgia 输出 " G " " E " " O " " R " " G " " I " " A " 例子 " Enter a word for me to spell: " Georgia " G " " E " " O " " R " " G " " I " " A " each_even_word.rb 编写一个程序,该程序:要求用户输入由空格分隔的单词列表。 该程序应只打印具有
each-chapter-master.zip
  • each-chapter-master
  • .gitignore
    33B
  • config.ru
    58B
  • .rspec
    69B
  • bin
  • rails
    232B
  • setup
    113B
  • server
    238B
  • each_letter_count.rb
    175B
  • .ruby-version
    6B
  • each_spell_word.rb
    142B
  • .theia
  • settings.json
    106B
  • spec
  • support
  • fizz_buzz.txt
    413B
  • hint_formatter.rb
    363B
  • json_output_formatter.rb
    1.8KB
  • scripts
  • each_spec.rb
    3.3KB
  • spec_helper.rb
    4.9KB
  • README.md
    1.8KB
  • each_even_word.rb
    226B
  • Gemfile
    283B
  • Rakefile
    97B
  • main.rb
    0B
  • .gitpod.yml
    510B
  • Gemfile.lock
    2.3KB
内容介绍
# 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: ```bash 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 ```bash "G" "E" "O" "R" "G" "I" "A" ``` Example ```bash "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) ```bash "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: ```bash "Enter a word" loop l appears 1 times o appears 2 times o appears 2 times p appears 1 times ``` ## Specs <details> <summary>Click here to see names of each test</summary> 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' </details>
评论