[Tutor] close, but no cigar

Dave Angel davea at davea.name
Tue Jul 23 03:13:55 CEST 2013


On 07/22/2013 02:27 PM, Jim Mooney wrote:
> Okay, I'm getting there, but this should be translating A umlaut to an old
> DOS box character, according to my ASCII table, but instead it's print
> small 'u':
>
> def main():
>      zark = ''
>      for x in "ÀÄÄÄ":
>          print(unichr(ord(u'x')-3), end=' ')
>
> result: u u u u
>

You're not using any of the A-umlaut characters in that code.  You're 
repeatedly taking ord of the literal u'x'

And naturally, u is 3 characters less than x.



-- 
DaveA



More information about the Tutor mailing list