<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 10/31/2013 7:52 AM, Carmen Salcedo
wrote:<br>
</div>
<blockquote
cite="mid:BLU402-EAS305C4B572C743777F5202FDEA0B0@phx.gbl"
type="cite">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div><span></span></div>
<div>
<div>I'm not able to post it right now. All I did to the
previous program i emailed was changed isalpha() to
str.isalpha.<br>
</div>
</div>
</blockquote>
That does agree with what you posted or got.<br>
<br>
The part of your original program that should print a character
already is <br>
print (str.isalpha()<br>
which raises this exception:<br>
<br>
File "N:\Script2.py", line 37, in phoneTranslator<br>
print(str.isalpha())<br>
TypeError: descriptor 'isalpha' of 'str' object needs an argument<br>
<br>
it should be<br>
<br>
print n<br>
<br>
Exactly what did you type in response to <br>
phoneNumber = raw_input ("Please enter the phone number: ")<br>
<br>
Note you are not consistent in converting letters:<br>
elif n == "G" or n == "H" or n == "I":<br>
n = "4"<br>
elif n == "J" or n == "K" or n == "L":<br>
n = 5<br>
all the numbers should be characters e.g. <br>
n = "5"<br>
etc.<br>
<br>
There are many ways to get the desired output.<br>
One is:<br>
collect the characters in one list, say numberList<br>
Then use slicing to insert the "-" e.g. numberList[3:3] = "-"<br>
Then print "".join(numberList)<br>
<br>
<pre class="moz-signature" cols="72">--
Bob Gailer
919-636-4239
Chapel Hill NC</pre>
</body>
</html>