Skip to content

learn-co-students/kwk-l1-silly_string-kwk-students-l1-bos-070918

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silly String

A string in Ruby is an data type that holds words, numbers, and other characters. A string is just data. This lab is going to be a refresher on how to create and manipulate strings. You'll code your solution in silly_string.rb

You can read about strings and all the methods available here.

Write your code and test it out manually by running ruby silly_string.rb in the command line. If the output looks like it's intended to, you're good to go!

You can run learn to see if the tests are passing.

Challenge:

  1. Create a string that contains your favorite word. It can be in any language!

  2. Using a method built into ruby, capitalize every letter in the string you just created

  3. Now let's make all the characters lowercase in the string "IM NOT SHOUTING"

  4. Using a method built into ruby, count how many letters are in the string "supercalifragilisticexpialidocious"

  5. Now let's add more words to that string, using + just like in math. That's called concatenation. Let's add together to the two strings "wow" and "mom".

  6. Now let's capitalize just the first letter of the sentence "i really like programming"

  7. Let's take the string "Astounding aardvarks, arguably an ancient animal, always ate apples and acorns and artichokes all around Athens, amazing!". We want to use the gsub method to switch all A for O, as well as all a for o. We'll need to chain gsubs.

KWK-L1 Silly String

Hints

Don't edit the variable names in the file. Try running ruby silly_string.rb to see what is being printed.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages