NSFCD

Generally Speaking => Power On => Topic started by: JMV on June 25, 2009, 05:32:29 PM

Title: This thread will be locked
Post by: JMV on June 25, 2009, 05:32:29 PM
Do you prefer Perl, Python, Ruby, Java, or PHP?
Title: Re: This thread will be locked
Post by: Macawmoses on June 25, 2009, 05:33:08 PM
PHP. I use it much more regularly than the others.
Title: Re: This thread will be locked
Post by: JMV on June 25, 2009, 05:35:59 PM
Quote from: Macbeth on June 25, 2009, 05:33:08 PM
PHP. I use it much more regularly than the others.
I wrote a Rot13 thing in Perl and Python today. I like the Perl solution a lot more. I need to look at Python's regex module though because I don't think it has tr and using a bunch of if statements inside of a loop isn't very nice.

#!/usr/bin/perl
print "Enter message to be encoded or decoded: ";
$message = <STDIN>;
chop($message);
$message =~ tr/A-Za-z/N-ZA-Mn-za-m/;
print "Your message is: \n \n";
print "$message\n";

#!/usr/bin/python
rot13 = input("Enter the message to be encoded or decoded: ")
rot13b = ''
for let in rot13:
   if ord(let) < 65:
       rot13b += let
   elif ord(let)<=77:
       rot13b += chr(ord(let)+13)
   elif ord(let)<=90:
       rot13b += chr(ord(let)-13)
   elif ord(let)<=109:
       rot13b += chr(ord(let)+13)
   elif ord(let)<=122:
       rot13b += chr(ord(let)-13)
   else:
       rot13b+= let           
print("Your encoded message is:\n\n %s"%rot13b)


p.s. the css on this theme makes the code tag fugly
Title: Re: This thread will be locked
Post by: Lotos on June 25, 2009, 05:42:21 PM
I don't know any of those.  I want to learn ;-;
Title: Re: This thread will be locked
Post by: jnfs2014 on June 25, 2009, 05:43:05 PM
Um.....inb4lock?

None, but I'm going to in like a year.

Title: Re: This thread will be locked
Post by: Nayrman on June 25, 2009, 05:45:37 PM
python because it's easy...
*dreads taking my Intro to Java course again*
Title: Re: This thread will be locked
Post by: bluaki on June 25, 2009, 06:27:52 PM
Quote from: Macbeth on June 25, 2009, 05:33:08 PM
PHP. I use it much more regularly than the others.
Same answer for the same reason.
I've never used any of the others yet, actually.
Quote from: JMV on June 25, 2009, 05:35:59 PM
p.s. the css on this theme makes the code tag fugly
What theme?
Title: Re: This thread will be locked
Post by: on June 25, 2009, 06:38:20 PM
I'm starting to doubt the validity of the topic creator and his thread title.

And I don't use any of those so I don't have a preference.
Title: Re: This thread will be locked
Post by: L10 on June 25, 2009, 08:33:47 PM
Python is friendly. I was trying to teach myself it at one point bet then I lost interest...
Title: Re: This thread will be locked
Post by: Rae on June 26, 2009, 04:13:44 PM
JMV is going to help me learn. And then JMV, Guff and I can fill up Boyah with Python talk. :)
Title: Re: This thread will be locked
Post by: Lotos on June 27, 2009, 08:32:33 AM
Quote from: Rae on June 26, 2009, 04:13:44 PM
JMV is going to help me learn. And then JMV, Guff and I can fill up Boyah with Python talk. :)

JMV help me too ;-;