03-03-2010, 08:43 PM
(02-20-2010, 09:48 PM)uber1337 Wrote: Not really sure about Ruby but imo Python is the easiest to learn and it has short clear syntax which is just fantastic for sharing/reading snippets. As far as how advanced Python can be when you get into topics such as the internet all I have to say is:
Google, Youtube
As for the example on the site:
Python:Code:say = "I love Ruby"
puts say
say['love'] = "*love*"
puts say.upcase
5.times { puts say }
Not only is the python code one line shorter, it looks prettyCode:say = 'I love Python'
print say
say.replace('love', '*love*')
print say.upper() * 5
Actually, just to point out, it's not 1 line shorter. The ruby script prints say in uppercase once and then prints say (not uppercased) 5 times. Your python code in ruby would be:
Code:
say = 'I love Ruby'
puts say
say['love'] = "*love*"
5.times {puts say.upcase}
Code:
say = 'I love Ruby'
puts say
5.times{puts say.sub(/love/,"*love*").upcase}