for some reason line 6 doesnt work.i converted it into a integer but
still i get the error ".
How_old_are_you?.rb:6:in `*': String can't be coerced into Fixnum
(TypeError)
from How_old_are_you?.rb:6
"
the * should work because i tried it. or if someone could tell me how to
do an input as a integer that would be great. but i would see of that
would have to work...
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
penta2100 (3)
|
10/7/2010 1:00:31 AM |
|
wrong one.lol
Attachments:
http://www.ruby-forum.com/attachment/5135/How_old_are_you_.rb
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
penta2100 (3)
|
10/7/2010 1:03:36 AM
|
|
heres the file
Attachments:
http://www.ruby-forum.com/attachment/5134/how_do_you_do_.rb
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
penta2100 (3)
|
10/7/2010 1:07:11 AM
|
|
You didn't save the result of .to_i.
That is to say, if you just do:
age.to_i
then that's all the machine does - creates a new int out of 'a'. But it
doesn't hold onto it if you don't tell it to. So you can either assign
it back to itself, somewhere else, or just call .to_i when it's actually
needed:
age = age.to_i
*or*
age_val = age.to_i
*or*
puts 86000*365*age.to_i
On Wed, 2010-10-06 at 20:00 -0500, Austin Delauney wrote:
> for some reason line 6 doesnt work.i converted it into a integer but
> still i get the error ".
> How_old_are_you?.rb:6:in `*': String can't be coerced into Fixnum
> (TypeError)
> from How_old_are_you?.rb:6
> "
> the * should work because i tried it. or if someone could tell me how to
> do an input as a integer that would be great. but i would see of that
> would have to work...
|
|
0
|
|
|
|
Reply
|
Alex
|
10/7/2010 1:26:57 AM
|
|
On Oct 6, 2010, at 18:26 , Alex Stahl wrote:
> puts 86000*365*age.to_i
As much as I dislike doing someone's homework for them... *shudder* I =
can't help being anal about calendrical calculations...
There are 86400 seconds in a day, and a fractional number of days in a =
year (365.242199). You'd be off by more than 2 months for someone my =
age. Probably not a huge deal for something like this, but you'd be =
really late to the eclipse...=
|
|
0
|
|
|
|
Reply
|
Ryan
|
10/7/2010 3:24:53 AM
|
|
Ryan Davis wrote:
> On Oct 6, 2010, at 18:26 , Alex Stahl wrote:
>
>> puts 86000*365*age.to_i
>
> There are 86400 seconds in a day, and a fractional number of days in a
> year (365.242199). You'd be off by more than 2 months for someone my
> age.
Are you... 240 years old?
(0.25 days * 240 years = 2 months)
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Albert
|
10/7/2010 4:43:31 AM
|
|
On Thu, Oct 7, 2010 at 6:43 AM, Albert Schlef <albertschlef@gmail.com> wrote:
> Ryan Davis wrote:
>> On Oct 6, 2010, at 18:26 , Alex Stahl wrote:
>>
>>> puts 86000*365*age.to_i
>>
>> There are 86400 seconds in a day, and a fractional number of days in a
>> year (365.242199). You'd be off by more than 2 months for someone my
>> age.
>
> Are you... 240 years old?
>
> (0.25 days * 240 years = 2 months)
You forgot to account for the lack of 400 seconds (6.666... minutes!) a day. ;)
--
Phillip Gawlowski
Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
|
|
0
|
|
|
|
Reply
|
Phillip
|
10/7/2010 6:18:13 AM
|
|
On Thu, Oct 7, 2010 at 12:43 AM, Albert Schlef <albertschlef@gmail.com> wrote:
> Ryan Davis wrote:
>> On Oct 6, 2010, at 18:26 , Alex Stahl wrote:
>>
>>> puts 86000*365*age.to_i
>>
>> There are 86400 seconds in a day, and a fractional number of days in a
>> year (365.242199). You'd be off by more than 2 months for someone my
>> age.
>
> Are you... 240 years old?
>
> (0.25 days * 240 years = 2 months)
That might explain why Ryan seems to get, shall we say, a bit
crotchety at times. <G>
And I thought *I* was old.
--
Rick DeNatale
Help fund my talk at Ruby Conf 2010:http://pledgie.com/campaigns/13677
Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
|
|
0
|
|
|
|
Reply
|
Rick
|
10/7/2010 12:31:18 PM
|
|
On Oct 7, 2010, at 05:31 , Rick DeNatale wrote:
> That might explain why Ryan seems to get, shall we say, a bit
> crotchety at times. <G>
>
> And I thought *I* was old.
Pththththt
|
|
0
|
|
|
|
Reply
|
Ryan
|
10/7/2010 7:00:17 PM
|
|
> As much as I dislike doing someone's homework for them... *shudder* I
> can't help being anal about calendrical calculations...
This isn't homework. i was doing a tutorial and it said make a app that
counts the seconds of someone. and i was all like ok! and i did it but i
couldn't figure the last art out. thanks!
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Austin
|
10/7/2010 7:48:46 PM
|
|
|
9 Replies
167 Views
(page loaded in 0.122 seconds)
Similiar Articles: How to get %CPU Utilization for performance testing using /proc in ...... ps') is sort of a weighted average over several seconds [ I don't know how many seconds ... Posted: Thu Mar 30, 2006 7:37 am Post subject: How to get %CPU Utilization for ... Need help #46 - comp.soft-sys.matlabPratap: Please define "slow" (how many seconds or minutes is it). Then define what "huge ... Please, maybe this is easy for you but i am just a newbie, so i really need your ... Predicting Next Day's High and Low in the forex market - comp.ai ...Hi Steve, I am not currently using RNN's and have very ... I'm getting old, I fear). Thanks, Carl Cook BioComp ... 6 Replies 52 Views (6.385 seconds) Tweet How to find how many file locks are being used by a process - comp ...I am using HP UNIX 11i. It is a production system. We are lunnnnig out of no of ... 2 Replies 157 Views (0.057 seconds) Tweet Checking of password expiry - comp.unix.solaris... an account whether its password has expired or how many ... 1 Replies 741 Views (0.029 seconds) Tweet ... 7/5/2012 6:32:58 AM Character count and character check in JTextField - comp.lang.java ...I am currently developing a java program that allows the user to enter numbers into ... the > user has entered 2 characters then the program continues to run. > > The second ... Need to lookup function arguments (in/out) from pdb by dbghelp ...My problem is I am also interested to get function parameters as well. As SYMBOL ... 0 Replies 193 Views (0.034 seconds) Tweet read file with variable column numbers - comp.soft-sys.matlab ...file1 file2 file3 file4 the second column decides how many numbers and filenames follows ... 7/9/2012 4:12:03 AM Reset whole config of a Cisco Catalyst 3548 XL switch - comp.dcom ...Hello, I am searching on cisco.com in ... How > can I do that ? > > many thanks > Don't bother I've found my old cisco ... 1 Replies 368 Views (0.067 seconds) Tweet How Does DP Technology Esprit Compare To Mastercam? - comp.cad.pro ...In many areas DP Technology Esprit blows Mastecam out of ... wordpress.com/ "June 11, 2008" Stale old bog. ... 7/6/2012 4:15:46 AM How Many Seconds Old am I - Ask CommunityIf you ever wanted to figure out how old you are in seconds you need a mathematical equation. But to put into more simple terms, take how many seconds are in 24 hours ... age calculator at Math Catsage calculator: how old are you in years, months, weeks, days, minutes, or seconds??? 7/13/2012 4:58:32 PM
|