Last active
February 2, 2020 05:44
Revisions
-
lovasoa revised this gist
Jan 14, 2020 . No changes.There are no files selected for viewing
-
lovasoa revised this gist
Jan 14, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import random SECRET = ''.join(random.choice("0123456789") for i in range(64)) class Sandbox: -
lovasoa revised this gist
Nov 28, 2019 . No changes.There are no files selected for viewing
-
lovasoa created this gist
Nov 28, 2019 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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()