Python Forum
phone number, to letters conversion
Thread Rating:
  • 3 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
phone number, to letters conversion
#9
I have a couple of questions about this code.
First, this block:
class klass:
    "docstring"
    def_int-self:
       self.attribute="var"
       if len (self.attribute)<2:
           pass
raises a SyntaxError on my machine for "invalid syntax" at 'def_int-self:'

Next, I don't see where the class 'klass' is used anywhere in the script at all, so I'm confused as to why it is there to begin with.

If I comment out that block of code, the program runs, but not as stated. Here is the output I get when I run it:
Output:
% phonecon.py This program will return all the letter conbinations that are available on the modern phone You just type in a seven digit number and let the program display all the letter conbinations that make up that number Enjoy Enter (0) to exit out of the program Enter a 7 digit phone number (NO spaces)>> 4487125 Enter numbers only no letters or special characters Enter (0) to exit out of the program Enter a 7 digit phone number (NO spaces)>> 0 Enter numbers only no letters or special characters Enter (0) to exit out of the program Enter a 7 digit phone number (NO spaces)>>
and that is it. It does not show me any letter combinations and 0 does not exit the program. I have to do a 'ps -e |grep python' to get a process id on the script then 'kill <pid>', because 'Ctrl-c' doesn't work to terminate it either.

I haven't yet looked too closely at the rest of the code. When I do, I will get back to you about anything I notice that might help.
Reply


Messages In This Thread
RE: phone number, to letters conversion - by nilamo - Dec-03-2018, 07:59 PM
RE: phone number, to letters conversion - by theprask - Dec-08-2018, 05:40 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020