Python Forum
Why this simple function doesnt work?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why this simple function doesnt work?
#1
>>> def correct(s):
    for c in s:
        if c=='1':
            c='I'
        if c=='5':
            c='S'
        if c=='0':
            c='O'
        else:
            c=c
    return s

>>> x = "1teruje5z t0"
>>> correct(x)
'1teruje5z t0'
W T F? Tried many things, this is simply as can be and still doesnt work.
Reply


Messages In This Thread
Why this simple function doesnt work? - by blackknite - Jan-05-2019, 11:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  print doesnt work in a function ony 2 232 Mar-11-2024, 12:42 PM
Last Post: Pedroski55
  Pydoc documentation doesnt work Cosmosso 5 4,263 Nov-25-2023, 11:17 PM
Last Post: vidito
  pip install requests doesnt work misodca 8 5,558 Jul-07-2023, 08:04 AM
Last Post: zyple
  Ldap3 Python print(conn.entries) doesnt work ilknurg 15 5,565 Dec-28-2022, 11:22 AM
Last Post: shad
  I dont know why my function won't work? MehHz2526 3 1,149 Nov-28-2022, 09:32 PM
Last Post: deanhystad
  pip install pystyle doesnt work person_probably 2 2,002 Sep-23-2022, 02:59 PM
Last Post: person_probably
  Why doesnt chunk generation work? LotosProgramer 1 1,908 Apr-02-2022, 08:25 AM
Last Post: deanhystad
  Join dataframes... So simple but I can't work it out! snakes 1 1,341 Oct-27-2021, 09:15 AM
Last Post: snakes
  time function does not work tester_V 4 2,945 Oct-17-2021, 05:48 PM
Last Post: tester_V
  write new function or change the old one to work "smartter? korenron 3 1,924 Aug-09-2021, 10:36 AM
Last Post: jamesaarr

Forum Jump:

User Panel Messages

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