10BC0 One more possible solution to telephone.py? · Issue #13 · kyclark/tiny_python_projects · GitHub
[go: up one dir, main page]

Skip to content

One more possible solution to telephone.py? #13

@GordoNice

Description

@GordoNice

Hello! Thanks for the cool book!

I might be wrong, but in telephone.py you suggest to use:
new_char = random.choice(alpha.replace(new_text[i], ''))

And my workaround for this was:

while True:
    new_char = random.choice(alpha)
    if new_char != new_text[i]:
        break

Is it valid? I think it is, but, using this solution I cannot pass the test... The reason for this is that after replacing character for nothing you are get random choice from another string...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0