Can any body please help me to solve this? Create a lottery app which will take a number as parameter and there will be a set of number from 0 to n random number every time. If the given number matches the random array[0] number by the program, show a message you won the loterry. If the given number matches the random array[1] number by the program, show a message you are second. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/7SgkoBTeIQgJ. For more options, visit https://groups.google.com/groups/opt_out.
Which university? ;) 2012/9/14 Samir <samirkanta.dash-cLM5J8oA4jhhmhkoCovsdw@public.gmane.org>> Can any body please help me to solve this? > > Create a lottery app which will take a number as parameter and there will > be a set of number from 0 to n random number every time. > If the given number matches the random array[0] number by the program, > show a message you won the loterry. > If the given number matches the random array[1] number by the program, > show a message you are second. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/7SgkoBTeIQgJ. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
BPUT On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:> > Can any body please help me to solve this? > > Create a lottery app which will take a number as parameter and there will > be a set of number from 0 to n random number every time. > If the given number matches the random array[0] number by the program, > show a message you won the loterry. > If the given number matches the random array[1] number by the program, > show a message you are second. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/TwujY3qIKJgJ. For more options, visit https://groups.google.com/groups/opt_out.
Here I have tried a bit. class Constlottery def self.rand_number randoms = [] loop do puts "Enter a random number" new_number = gets.chomp if new_number.to_s == rand(1..9).to_s puts "You are winner" return else puts "You lost the chance" end end end end a = Constlottery.rand_number puts a On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:> > Can any body please help me to solve this? > > Create a lottery app which will take a number as parameter and there will > be a set of number from 0 to n random number every time. > If the given number matches the random array[0] number by the program, > show a message you won the loterry. > If the given number matches the random array[1] number by the program, > show a message you are second. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/5G5asAK5TDsJ. For more options, visit https://groups.google.com/groups/opt_out.
On Mon, Sep 17, 2012 at 7:02 PM, Samir <samirkanta.dash-cLM5J8oA4jhhmhkoCovsdw@public.gmane.org>wrote:> Here I have tried a bit. > > > class Constlottery > def self.rand_number > randoms = [] > loop do > puts "Enter a random number" > new_number = gets.chomp > if new_number.to_s == rand(1..9).to_s > puts "You are winner" > return > else > puts "You lost the chance" > end > end > end > end > > a = Constlottery.rand_number > > puts aHi Samir, Please consider the following - this groups isn''t something that you can expect to work on your university assignments - we expect you to try and accomplish something by yourself, or search through google, or read some tutorials first before posting here - this post is already 3 days old so you should''ve made more progress than what you have right now - hearing "I''ve tried a bit" gives the notion that you haven''t tried at all - try to analyze what each line of code does and i''m sure you''ll get it - get back to this group if you''re really stuck. give us insights on what you''ve done to debug the problem and maybe, there''ll be someone here in the groups to help you Good luck!> > > > > > > > > > > > > On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote: > >> Can any body please help me to solve this? >> >> Create a lottery app which will take a number as parameter and there will >> be a set of number from 0 to n random number every time. >> If the given number matches the random array[0] number by the program, >> show a message you won the loterry. >> If the given number matches the random array[1] number by the program, >> show a message you are second. >> >> -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/5G5asAK5TDsJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Hi Jim. Thanks for the Suggestions. I will definitely work on it..But as i am new to Ruby m a bit worried how to catch the track and jump for development. On Monday, September 17, 2012 2:43:47 PM UTC+5:30, jim wrote:> > > > On Mon, Sep 17, 2012 at 7:02 PM, Samir <samirka...-cLM5J8oA4jhhmhkoCovsdw@public.gmane.org<javascript:> > > wrote: > >> Here I have tried a bit. >> >> >> class Constlottery >> def self.rand_number >> randoms = [] >> loop do >> puts "Enter a random number" >> new_number = gets.chomp >> if new_number.to_s == rand(1..9).to_s >> puts "You are winner" >> return >> else >> puts "You lost the chance" >> end >> end >> end >> end >> >> a = Constlottery.rand_number >> >> puts a > > > Hi Samir, > > Please consider the following > > - this groups isn''t something that you can expect to work on your > university assignments > - we expect you to try and accomplish something by yourself, or search > through google, or read some tutorials first before posting here > - this post is already 3 days old so you should''ve made more progress > than what you have right now > - hearing "I''ve tried a bit" gives the notion that you haven''t tried > at all > - try to analyze what each line of code does and i''m sure you''ll get it > - get back to this group if you''re really stuck. give us insights on > what you''ve done to debug the problem and maybe, there''ll be someone here > in the groups to help you > > Good luck! > > >> >> >> >> >> >> >> >> >> >> >> >> >> On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote: >> >>> Can any body please help me to solve this? >>> >>> Create a lottery app which will take a number as parameter and there >>> will be a set of number from 0 to n random number every time. >>> If the given number matches the random array[0] number by the program, >>> show a message you won the loterry. >>> If the given number matches the random array[1] number by the program, >>> show a message you are second. >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:> >> . >> To unsubscribe from this group, send email to >> rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/5G5asAK5TDsJ. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > ------------------------------------------------------------- > visit my blog at http://jimlabs.heroku.com >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/U09VrTzVlu8J. For more options, visit https://groups.google.com/groups/opt_out.
On Mon, Sep 17, 2012 at 7:28 PM, Samir <samirkanta.dash-cLM5J8oA4jhhmhkoCovsdw@public.gmane.org>wrote:> Hi Jim. Thanks for the Suggestions. I will definitely work on it..But as i > am new to Ruby m a bit worried how to catch the track and jump for > development. >Is this something that the university gave you as a personal exercise? Or is this from some site tutorial you''re following. Either way, you should start at the basics of ruby if you''re really new to the language.> > On Monday, September 17, 2012 2:43:47 PM UTC+5:30, jim wrote: >> >> >> >> On Mon, Sep 17, 2012 at 7:02 PM, Samir <samirka...-cLM5J8oA4jjGNzoMY4ZM7g@public.gmane.org**in>wrote: >> >>> Here I have tried a bit. >>> >>> >>> class Constlottery >>> def self.rand_number >>> randoms = [] >>> loop do >>> puts "Enter a random number" >>> new_number = gets.chomp >>> if new_number.to_s == rand(1..9).to_s >>> puts "You are winner" >>> return >>> else >>> puts "You lost the chance" >>> end >>> end >>> end >>> end >>> >>> a = Constlottery.rand_number >>> >>> puts a >> >> >> Hi Samir, >> >> Please consider the following >> >> - this groups isn''t something that you can expect to work on your >> university assignments >> - we expect you to try and accomplish something by yourself, or >> search through google, or read some tutorials first before posting here >> - this post is already 3 days old so you should''ve made more progress >> than what you have right now >> - hearing "I''ve tried a bit" gives the notion that you haven''t tried >> at all >> - try to analyze what each line of code does and i''m sure you''ll get >> it >> - get back to this group if you''re really stuck. give us insights on >> what you''ve done to debug the problem and maybe, there''ll be someone here >> in the groups to help you >> >> Good luck! >> >> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote: >>> >>>> Can any body please help me to solve this? >>>> >>>> Create a lottery app which will take a number as parameter and there >>>> will be a set of number from 0 to n random number every time. >>>> If the given number matches the random array[0] number by the program, >>>> show a message you won the loterry. >>>> If the given number matches the random array[1] number by the program, >>>> show a message you are second. >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ruby on Rails: Talk" group. >>> To post to this group, send email to rubyonra...@googlegroups.**com. >>> To unsubscribe from this group, send email to rubyonrails-ta...@** >>> googlegroups.com. >>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/rubyonrails-talk/-/**5G5asAK5TDsJ<https://groups.google.com/d/msg/rubyonrails-talk/-/5G5asAK5TDsJ> >>> . >>> >>> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> >>> >> >> >> >> -- >> ------------------------------**------------------------------**- >> visit my blog at http://jimlabs.heroku.com >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/U09VrTzVlu8J. > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Personal Exercise.... On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:> > Can any body please help me to solve this? > > Create a lottery app which will take a number as parameter and there will > be a set of number from 0 to n random number every time. > If the given number matches the random array[0] number by the program, > show a message you won the loterry. > If the given number matches the random array[1] number by the program, > show a message you are second. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Ru8mpF9h2iIJ. For more options, visit https://groups.google.com/groups/opt_out.