[SOLUTION] Current Temperature (#68)

D

David Tran

My one-line solution.
Just join the below 4 lines become one single line; even no need space
when join lines.

require'open-uri';puts (ARGV.size !=3D1)?"Usage: #$0 <zip code>":
("The temperature in #$1 is #$2 degrees F."if
%r|Weather</b> for <b>(.*?)</b>.*?(\d+)&deg;F|=3D~
open("http://www.google.com/search?hl=3Den&q=3Dtemperature+#{ARGV[0]}"){|f|=
f.read})
 
D

dave

| Semi-colons, that is so cheating

require("open-uri") && puts((ARGV.size !=1) ? "Usage: #$0 <zip code>": ("The
temperature in #$1 is #$2 degrees F." if %r|Weather</b> for <b>(.*?)</b>.*?
(\d+)&deg;F|
=~open("http://www.google.com/search?hl=en&q=temperature+#{ARGV[0]}"){|f|
f.read}))


This is without semi-colons :)


--
here are more things in heaven and earth,
horatio, than are dreamt of in your philosophy.


--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
DVD vergini: acquista online a prezzi vantaggiosi!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4589&d=2-3
 

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

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top