[Tutor] (no subject)

Lance E Sloan lsloan-000002 at umich.edu
Tue Jun 8 12:21:36 EDT 2004


--On Monday, June 7, 2004 11:36 PM -0400 Dragonfirebane at aol.com wrote:
>   else:
>       if char in number:
>           convertnum()
>           pass

I think you don't want "if".  You want "for":

  for char in number:

And you should pass that value into your function:

    convertnum( char )

And change your function definition to accept the value, as Jeremy 
sugegsted:

  def convertxt( char ):

Also, I think you're going to run into other problems.  For example, where 
do you define "alphabet"?

>> > def convertxt():
>> >     if char in alphabet[:26]:
>> >         print binary[alphabet.index(original)]
>> >     elif char in alphabet[26:]:
>> >         print binary[alphabet.index(original)]

--
Lance E Sloan, Systems Research Programmer III
U-M WATS: Web Applications, Technologies, and Solutions
Full-service web and database design, development, and hosting.
http://www.itcs.umich.edu/wats/ - "Putting U on the Web"




More information about the Tutor mailing list