Skip to content

Instantly share code, notes, and snippets.

@lovasoa
Last active February 2, 2020 05:44

Revisions

  1. lovasoa revised this gist Jan 14, 2020. No changes.
  2. lovasoa revised this gist Jan 14, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion challenge.py
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    #!/usr/bin/env python3
    import random

    SECRET = open(".passwd").read()
    SECRET = ''.join(random.choice("0123456789") for i in range(64))

    class Sandbox:

  3. lovasoa revised this gist Nov 28, 2019. No changes.
  4. lovasoa created this gist Nov 28, 2019.
    26 changes: 26 additions & 0 deletions challenge.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/usr/bin/env python3

    SECRET = open(".passwd").read()

    class Sandbox:

    def ask_age(self):
    self.age = input("How old are you ? ")
    self.width = input("How wide do you want the nice box to be ? ")

    def ask_secret(self):
    if input("What is the secret ? ") == SECRET:
    print("You found the secret ! I thought this was impossible.")
    else:
    print("Wrong secret")

    def run(self):
    while True:
    self.ask_age()
    to_format = f"""
    Printing a {self.width}-character wide box:
    [Age: {{self.age:{self.width}}} ]"""
    print(to_format.format(self=self))
    self.ask_secret()

    Sandbox().run()