Sponsored Content
Top Forums Programming Programming Challenges - A List Post 302119033 by blowtorch on Saturday 26th of May 2007 10:42:24 PM
Old 05-26-2007
In the interest of laziness (and the fact that I am busy at work right now), here's a python version.
Code:
#!/usr/local/bin/python

morseDict=dict([('A','.-'),('B','-...'),('C','-.-.'),('D','-..'),('E','.'),('F','..-.'),('G','--.'),('H','....'),('I','..'),('J','.---'),('K','-.-'),('L','.-..'),('M','--'),('N','-.'),('O','---'),('P','.--.'),('Q','--.-'),('R','.-.'),('S','...'),('T','-'),('U','..-'),('V','...-'),('W','.--'),('X','-..-'),('Y','-.--'),('Z','--..'),('0','-----'),('1','.----'),('2','..---'),('3','...--'),('4','....-'),('5','.....'),('6','-....'),('7','--...'),('8','---..'),('9','----.')])

inputLine=raw_input()
inputLine=inputLine.upper()

for letter in inputLine:
        if letter == " ":
                print "  ",
        else:
                print morseDict[letter],

This is written on a server, so I'm not going to try for the sounds bit (there's no way for me to verify if my Solaris box is beeping away or not).

-edit
Currently handles only letters and numbers

Last edited by blowtorch; 05-26-2007 at 11:52 PM..
 

3 More Discussions You Might Find Interesting

1. AIX

AIX 6.1 IDSLDAP Installation Challenges

Please bare with me, since I am new to AIX and LDAP. I am attempting to install idsldap server on our AIX 6.1 NIM server. I installed the following packages: root@nim(/)# lslpp -l|grep ldap db2_08_01.ldap 8.1.1.80 COMMITTED DB2 LDAP Support idsldap.clt64bit61.rte 6.1.0.17 COMMITTED... (6 Replies)
Discussion started by: ecollins
6 Replies

2. UNIX for Advanced & Expert Users

Challenges in finding and copying the block

Hi, I have a below challenging task where iam unable to find the block and copy the same into a file. I tried my luck,howver iam unable to reach the first and second step..Can anyone help me with a clue or with the commands so that i can give a try. 1. search the <number>9966993366</number>... (2 Replies)
Discussion started by: cskumar
2 Replies

3. Shell Programming and Scripting

Korn shell script - SQL statement challenges

Hi scripting experts. I have some coding challenges that I'm hoping you can help me out. I have one file#1 that contains the following sql statement that spans over multiple lines: sql Select /*+ use_has(a,b) */ * from customer a, customer_address b where a.id = b.id... (1 Reply)
Discussion started by: pchang
1 Replies
GEOIP_COUNTRY_CODE3_BY_NAME(3)						 1					    GEOIP_COUNTRY_CODE3_BY_NAME(3)

geoip_country_code3_by_name - Get the three letter country code

SYNOPSIS
string geoip_country_code3_by_name (string $hostname) DESCRIPTION
The geoip_country_code3_by_name(3) function will return the three letter country code corresponding to a hostname or an IP address. PARAMETERS
o $hostname - The hostname or IP address whose location is to be looked-up. RETURN VALUES
Returns the three letter country code on success, or FALSE if the address cannot be found in the database. EXAMPLES
Example #1 A geoip_country_code3_by_name(3) example This will print where the host example.com is located. <?php $country = geoip_country_code3_by_name('www.example.com'); if ($country) { echo 'This host is located in: ' . $country; } ?> The above example will output: This host is located in: USA SEE ALSO
geoip_country_code_by_name(3), geoip_country_name_by_name(3). PHP Documentation Group GEOIP_COUNTRY_CODE3_BY_NAME(3)
All times are GMT -4. The time now is 03:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy