Complete the code to concatenate two strings using the + operator.
greeting = "Hello, " [1] "world!"
The + operator joins two strings together to make one string.
Complete the code to append a string to another string using the << operator.
name = "Ruby" name [1] " is fun!"
The << operator appends the right string to the left string, modifying it in place.
Fix the error in the code to correctly concatenate strings using <<.
message = "Hi" message [1]= " there!"
The << operator can be used with = to append and modify the original string.
Complete the code to create a hash where keys are words and values are their lengths using string concatenation.
words = ["cat", "dog", "bird"] lengths = {word: for word in words if word[1] 3}
The colon : separates keys and values in a hash. The > operator filters words longer than 3 letters.
Fill all three blanks to build a hash with uppercase keys and values greater than 3.
words = ["apple", "bat", "carrot"] result = {word[1] word.length for word in words if word.length [2] 3 and word[3] "a"}
.upcase converts the word to uppercase for the key. > filters words longer than 3. .include? checks if the word contains 'a'.