Help

D

Daniel Kindler

okay, so in the book im reading it wanted me to do 2 things



1) wanted me to make a method for sorting a list of words

this is what i got now

def arange
arr = []
puts arr.sort.join(', ')
word = gets.chomp
while word != ""
arr << word
word = gets.chomp
end
end

arange

why isnt it working?




2) It wants me to make and "old school roman numerals" thing

so if i put a number it, it would return it in roman numerals, but NOT
subtraction
so like 4 would be IIII , not IV


IM CONFUSED WITH THAT!!! any body can give me a little hint on how to
start?
thx
 
V

Victor Reyes

[Note: parts of this message were removed to make it a legal post.]

okay, so in the book im reading it wanted me to do 2 things



1) wanted me to make a method for sorting a list of words

this is what i got now

def arange
arr = []
puts arr.sort.join(', ')
word = gets.chomp
while word != ""
arr << word
word = gets.chomp
end
end

arange

why isnt it working?
Daniel,

I am not sure if your comment: "that was helpful" was meant to be sarcastic
or if you really found the link helpful.
However, if you if you still needs help, see below:

I am no Ruby expert but I re-arranged your code and it works:

def arange
arr = []
word = gets.chomp
while word != ""
arr << word
word = gets.chomp
end

puts arr.sort.join(', ')

end
arange

ruby mypgm.rb

orange
banana
Apple
Banana
Cherries
mango

Apple, Banana, Cherries, banana, mango, orange


2) It wants me to make and "old school roman numerals" thing

so if i put a number it, it would return it in roman numerals, but NOT
subtraction
so like 4 would be IIII , not IV


IM CONFUSED WITH THAT!!! any body can give me a little hint on how to
start?
thx
For your second question I also find it confusing. But you can find many
examples on the web, *google*, about playing with roman numerals.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top